Re: [PATCH] s390: move from strlcpy with unused retval to strscpy

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

 



On Thu, Aug 18, 2022 at 11:01:01PM +0200, Wolfram Sang wrote:
> Follow the advice of the below link and prefer 'strscpy' in this
> subsystem. Conversion is 1:1 because the return value is not used.
> Generated by a coccinelle script.
> 
> Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@xxxxxxxxxxxxxx/
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/s390/block/dasd_devmap.c | 2 +-
>  drivers/s390/block/dasd_eer.c    | 4 ++--
>  drivers/s390/block/dcssblk.c     | 2 +-
>  drivers/s390/char/hmcdrv_cache.c | 2 +-
>  drivers/s390/char/tape_class.c   | 4 ++--
>  drivers/s390/cio/qdio_debug.c    | 2 +-
>  drivers/s390/net/ctcm_main.c     | 2 +-
>  drivers/s390/net/fsm.c           | 2 +-
>  drivers/s390/net/qeth_ethtool.c  | 4 ++--
>  drivers/s390/scsi/zfcp_aux.c     | 2 +-
>  drivers/s390/scsi/zfcp_fc.c      | 2 +-
>  11 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
> index 4bb7965daa0f..1a9714af51e4 100644
> --- a/drivers/s390/cio/qdio_debug.c
> +++ b/drivers/s390/cio/qdio_debug.c
> @@ -87,7 +87,7 @@ int qdio_allocate_dbf(struct qdio_irq *irq_ptr)
>  			debug_unregister(irq_ptr->debug_area);
>  			return -ENOMEM;
>  		}
> -		strlcpy(new_entry->dbf_name, text, QDIO_DBF_NAME_LEN);
> +		strscpy(new_entry->dbf_name, text, QDIO_DBF_NAME_LEN);
>  		new_entry->dbf_info = irq_ptr->debug_area;
>  		mutex_lock(&qdio_dbf_list_mutex);
>  		list_add(&new_entry->dbf_list, &qdio_dbf_list);
> diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
> index fd2f1c31bd21..df782646e856 100644
> --- a/drivers/s390/scsi/zfcp_aux.c
> +++ b/drivers/s390/scsi/zfcp_aux.c
> @@ -103,7 +103,7 @@ static void __init zfcp_init_device_setup(char *devstr)
>  	token = strsep(&str, ",");
>  	if (!token || strlen(token) >= ZFCP_BUS_ID_SIZE)
>  		goto err_out;
> -	strlcpy(busid, token, ZFCP_BUS_ID_SIZE);
> +	strscpy(busid, token, ZFCP_BUS_ID_SIZE);
>  
>  	token = strsep(&str, ",");
>  	if (!token || kstrtoull(token, 0, (unsigned long long *) &wwpn))
> diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
> index b61acbb09be3..77917b339870 100644
> --- a/drivers/s390/scsi/zfcp_fc.c
> +++ b/drivers/s390/scsi/zfcp_fc.c
> @@ -885,7 +885,7 @@ static int zfcp_fc_gspn(struct zfcp_adapter *adapter,
>  			 dev_name(&adapter->ccw_device->dev),
>  			 init_utsname()->nodename);
>  	else
> -		strlcpy(fc_host_symbolic_name(adapter->scsi_host),
> +		strscpy(fc_host_symbolic_name(adapter->scsi_host),
>  			gspn_rsp->gspn.fp_name, FC_SYMBOLIC_NAME_SIZE);
>  
>  	return 0;
> -- 
> 2.35.1
> 

Those look good to me.

As far as zFCP and QDIO go:

Acked-by: Benjamin Block <bblock@xxxxxxxxxxxxx>

-- 
Best Regards, Benjamin Block  / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH    /    https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen         /         Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux