Re: [PATCH -next] scsi: qla2xxx: replace simple_strtoul to kstrtoul

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

 





On 2024/8/30 20:13, Bart Van Assche wrote:
On 8/30/24 4:05 AM, Hongbo Li wrote:
-    num_act_qp = simple_strtoul(buf, NULL, 0);
+    if (kstrtoul(buf, 0, &num_act_qp)) {
+        pr_err("host:%ld: fail to parse user buffer into number.",
+            vha->host_no);
+        rc = -EINVAL;
+        goto out_free;
+    }

The message "fail to parse user buffer into number" is a bit long.
"failed to parse" is probably sufficient.

Additionally, has it been considered to assign the kstrtoul() return
value to rc instead of discarding the returned value?
kstrtoul can tell two error which are ERANGE and EINVAL. rc can keep return value from kstrtoul, and it won't affect the original code. Can I use rc to hold the return value from kstrtoul?

Thanks,
Hongbo


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