diff mbox

[1/2] scsi: qla2xxx: remove incorrect byte swap

Message ID 20170630161056.30630-1-arnd@arndb.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Arnd Bergmann June 30, 2017, 4:10 p.m. UTC
cont_pkt->entry_type is an 8-bit field, so doing a 32-bit byteswap
on it will store incorrect data:

drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
drivers/scsi/qla2xxx/qla_nvme.c:444:27: note: in expansion of macro 'cpu_to_le32'
    cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);

This removes the erroneous cpu_to_le32().

Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Bottomley June 30, 2017, 4:41 p.m. UTC | #1
On Fri, 2017-06-30 at 18:10 +0200, Arnd Bergmann wrote:
> cont_pkt->entry_type is an 8-bit field, so doing a 32-bit byteswap
> on it will store incorrect data:
> 
> drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
> include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer
> implicitly truncated to unsigned type [-Werror=overflow]
> drivers/scsi/qla2xxx/qla_nvme.c:444:27: note: in expansion of macro
> 'cpu_to_le32'
>     cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
> 
> This removes the erroneous cpu_to_le32().
> 
> Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization
> and transport registration")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c
> b/drivers/scsi/qla2xxx/qla_nvme.c
> index 1da8fa8f641d..14e25e32e622 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -441,7 +441,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
>  				req->ring_ptr++;
>  			}
>  			cont_pkt = (cont_a64_entry_t *)req-
> >ring_ptr;
> -			cont_pkt->entry_type =
> cpu_to_le32(CONTINUE_A64_TYPE);
> +			cont_pkt->entry_type = CONTINUE_A64_TYPE;


We already have a patch proposed for this, but I think it may be wrong
(it's the same as yours, so yours may be wrong too) see the handling in
qla_iocb.c

James
Madhani, Himanshu June 30, 2017, 5 p.m. UTC | #2
> On Jun 30, 2017, at 9:41 AM, James Bottomley <jejb@linux.vnet.ibm.com> wrote:
> 
> On Fri, 2017-06-30 at 18:10 +0200, Arnd Bergmann wrote:
>> cont_pkt->entry_type is an 8-bit field, so doing a 32-bit byteswap
>> on it will store incorrect data:
>> 
>> drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
>> include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer
>> implicitly truncated to unsigned type [-Werror=overflow]
>> drivers/scsi/qla2xxx/qla_nvme.c:444:27: note: in expansion of macro
>> 'cpu_to_le32'
>>     cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
>> 
>> This removes the erroneous cpu_to_le32().
>> 
>> Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization
>> and transport registration")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c
>> b/drivers/scsi/qla2xxx/qla_nvme.c
>> index 1da8fa8f641d..14e25e32e622 100644
>> --- a/drivers/scsi/qla2xxx/qla_nvme.c
>> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
>> @@ -441,7 +441,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
>>  				req->ring_ptr++;
>>  			}
>>  			cont_pkt = (cont_a64_entry_t *)req-
>>> ring_ptr;
>> -			cont_pkt->entry_type =
>> cpu_to_le32(CONTINUE_A64_TYPE);
>> +			cont_pkt->entry_type = CONTINUE_A64_TYPE;
>>  
> 
> We already have a patch proposed for this, but I think it may be wrong
> (it's the same as yours, so yours may be wrong too) see the handling in
> qla_iocb.c
> 
> James

I will send patch which has correct usage in qla_iocb.c shortly. 

Thanks,
- Himanshu
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 1da8fa8f641d..14e25e32e622 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -441,7 +441,7 @@  static int qla2x00_start_nvme_mq(srb_t *sp)
 				req->ring_ptr++;
 			}
 			cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
-			cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
+			cont_pkt->entry_type = CONTINUE_A64_TYPE;
 
 			cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
 			avail_dsds = 5;