Re: [PATCH] scsi: fcoe: replace deprecated strncpy with strscpy

2023-10-24 Thread Bart Van Assche
On 10/24/23 12:52, Justin Stitt wrote: diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c index e17957f8085c..7a3ca6cd3030 100644 --- a/drivers/scsi/fcoe/fcoe_sysfs.c +++ b/drivers/scsi/fcoe/fcoe_sysfs.c @@ -279,12 +279,10 @@ static ssize_t store_ctlr_mode(struct device

Re: [PATCH] scsi: fcoe: replace deprecated strncpy with strscpy

2023-12-11 Thread Bart Van Assche
On 12/11/23 12:08, Justin Stitt wrote: Hi, On Tue, Oct 24, 2023 at 1:01 PM Bart Van Assche wrote: On 10/24/23 12:52, Justin Stitt wrote: diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c index e17957f8085c..7a3ca6cd3030 100644 --- a/drivers/scsi/fcoe/fcoe_sysfs.c

Re: [PATCH 00/10] scsi: Replace {v}snprintf() variants with safer alternatives

2024-02-08 Thread Bart Van Assche
On 2/8/24 00:44, Lee Jones wrote: Cc: Andre Hedrick Please take a look at https://lwn.net/Articles/508222/. Thanks, Bart.

Re: [PATCH] scsi: hpsa: Replace deprecated strncpy() with strscpy()

2025-02-13 Thread Bart Van Assche
On 2/13/25 3:24 AM, Thorsten Blum wrote: This subtle difference between strncpy() and strscpy() regarding the number of bytes copied isn't really documented anywhere, is it? The documentation I came across so far seems to focus mostly on the different return values of the two functions. From th

Re: [PATCH v2] scsi: hpsa: Replace deprecated strncpy() with strscpy()

2025-02-13 Thread Bart Van Assche
On 2/13/25 11:53 AM, Thorsten Blum wrote: diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 84d8de07b7ae..c7ebae24b09f 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -460,9 +460,8 @@ static ssize_t host_store_hp_ssd_smart_path_status(struct device *dev, if (!capab

Re: [PATCH v2] scsi: hpsa: Replace deprecated strncpy() with strscpy_pad()

2025-02-13 Thread Bart Van Assche
able(struct CfgTable __iomem *cfgtable) Has it been considered to introduce a Coccinelle semantic patch that performs this conversion? See also the scripts/coccinelle directory. Anyway: Reviewed-by: Bart Van Assche

Re: [PATCH v3] scsi: hpsa: Remove deprecated and unnecessary strncpy()

2025-02-18 Thread Bart Van Assche
On 2/14/25 3:43 AM, Thorsten Blum wrote: While replacing strncpy() with strscpy(), Bart Van Assche pointed out that the code occurs inside sysfs write callbacks, which already uses NUL-terminated strings. This allows the string to be passed directly to sscanf() without requiring a temporary copy