Re: [PATCH 09/20] iscsi: Suppress two clang format mismatch warnings

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

 



On Tue, 2021-04-13 at 10:07 -0700, Bart Van Assche wrote:
> Suppress two instances of the following clang compiler warning:
> 
> warning: format specifies type 'unsigned short'
>       but the argument has type 'int' [-Wformat]
> 
> Cc: Lee Duncan <lduncan@xxxxxxxx>
> Cc: Chris Leech <cleech@xxxxxxxxxx>
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
>  drivers/scsi/libiscsi.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index 7ad11e42306d..0c3082d09712 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -3587,10 +3587,11 @@ int iscsi_conn_get_addr_param(struct
> sockaddr_storage *addr,
>  	case ISCSI_PARAM_CONN_PORT:
>  	case ISCSI_PARAM_LOCAL_PORT:
>  		if (sin)
> -			len = sprintf(buf, "%hu\n", be16_to_cpu(sin-
> >sin_port));
> +			len = sprintf(buf, "%hu\n",
> +				      (u16)be16_to_cpu(sin->sin_port));
>  		else
>  			len = sprintf(buf, "%hu\n",
> -				      be16_to_cpu(sin6->sin6_port));
> +				      (u16)be16_to_cpu(sin6-
> 

This looks odd: the generic definition of be16_to_cpu on le is

#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))

and __swab16 is

#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))

So why doesn't clang see the existing __u16 as short?  This smells like
a problem in the compiler file.

James





[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