When getting string from userspace by simple_write_to_buffer
in ufs_qcom_dbg_testbus_cfg_write() function, null byte may
be written out of bounds of configuration buffer if return
value is same as size of buffer, causing off-by-one bug.
This change passes correct available size of configuration
buffer to simple_write_to_buffer function.
Change-Id: If6085e806aa34622a9a57b02f563869c51011d2f
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
struct ufs_hba *hba = host->hba;
struct ufs_hba *hba = host->hba;
- ret = simple_write_to_buffer(configuration, TESTBUS_CFG_BUFF_LINE_SIZE,
+ ret = simple_write_to_buffer(configuration,
+ TESTBUS_CFG_BUFF_LINE_SIZE - 1,
&buff_pos, ubuf, cnt);
if (ret < 0) {
dev_err(host->hba->dev, "%s: failed to read user data\n",
&buff_pos, ubuf, cnt);
if (ret < 0) {
dev_err(host->hba->dev, "%s: failed to read user data\n",