Re: [PATCH v3 1/1] scsi: ufs: core: Support Updating UIC Command Timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/10/2024 10:46 PM, Bao D. Nguyen wrote:
On 7/9/2024 11:10 AM, Bart Van Assche wrote:
On 7/8/24 11:06 PM, Bao D. Nguyen wrote:
+static int uic_cmd_timeout_set(const char *val, const struct kernel_param *kp)
+{
+    unsigned int n;
+    int ret;
+
+    ret = kstrtou32(val, 0, &n);
+    if (ret != 0 || n < UIC_CMD_TIMEOUT_DEFAULT || n > UIC_CMD_TIMEOUT_MAX)
+        return -EINVAL;
+
+    return param_set_int(val, kp);
+}

The above code converts 'val' twice to an integer: a first time by
calling kstrtou32() and a second time by calling param_set_int().
Please remove one of the two string-to-integer conversions, e.g. by
changing "param_set_int(val, kp)" into "uic_cmd_timeout = n" or
*(unsigned int *)kp->arg = n".
Hi Bart,
My understanding is that in the kstrtou32() function, the  the result of the conversion is written to the third parameter only which is '&n' in this case. 'val' does not get updated (and it cannot be updated because of its 'const' type). Please correct me if I am wrong.
Hi Bart,
Maybe I misunderstood your comment. You probably was concerned about the execution time of param_set_int(val, kp) vs a single assignment instruction 'uic_cmd_timeout = n;', right? If that's the case, I'll update the patch.

Thanks, Bao


Thanks, Bao


Thanks,

Bart.






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux