Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604257 > unrolled thread

[PATCH] qedf: fix wrong le16 conversion

Started byArnd Bergmann <arnd@arndb.de>
First post2017-03-20 10:00 +0100
Last post2017-03-23 21:10 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] qedf: fix wrong le16 conversion Arnd Bergmann <arnd@arndb.de> - 2017-03-20 10:00 +0100
    Re: [PATCH] qedf: fix wrong le16 conversion "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-23 15:20 +0100
      Re: [PATCH] qedf: fix wrong le16 conversion David Miller <davem@davemloft.net> - 2017-03-23 20:00 +0100
        Re: [PATCH] qedf: fix wrong le16 conversion "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-23 21:10 +0100

#1604257 — [PATCH] qedf: fix wrong le16 conversion

FromArnd Bergmann <arnd@arndb.de>
Date2017-03-20 10:00 +0100
Subject[PATCH] qedf: fix wrong le16 conversion
Message-ID<tn1kt-2eN-9@gated-at.bofh.it>
gcc points out that we are converting a 16-bit integer into a 32-bit
little-endian type and assigning that to 16-bit little-endian
will end up with a zero:

drivers/scsi/qedf/drv_fcoe_fw_funcs.c: In function 'init_initiator_rw_fcoe_task':
include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
  t_st_ctx->read_write.rx_id = cpu_to_le32(FCOE_RX_ID);

The correct solution appears to be to just use a 16-bit byte swap instead.

Fixes: be086e7c53f1 ("qed*: Utilize Firmware 8.15.3.0")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/qedf/drv_fcoe_fw_funcs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qedf/drv_fcoe_fw_funcs.c b/drivers/scsi/qedf/drv_fcoe_fw_funcs.c
index bb812db48da6..8c65e3b034dc 100644
--- a/drivers/scsi/qedf/drv_fcoe_fw_funcs.c
+++ b/drivers/scsi/qedf/drv_fcoe_fw_funcs.c
@@ -8,7 +8,7 @@
 #include "drv_fcoe_fw_funcs.h"
 #include "drv_scsi_fw_funcs.h"
 
-#define FCOE_RX_ID ((u32)0x0000FFFF)
+#define FCOE_RX_ID (0xFFFFu)
 
 static inline void init_common_sqe(struct fcoe_task_params *task_params,
 				   enum fcoe_sqe_request_type request_type)
@@ -59,7 +59,7 @@ int init_initiator_rw_fcoe_task(struct fcoe_task_params *task_params,
 	t_st_ctx->read_only.task_type = task_params->task_type;
 	SET_FIELD(t_st_ctx->read_write.flags,
 		  FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME, 1);
-	t_st_ctx->read_write.rx_id = cpu_to_le32(FCOE_RX_ID);
+	t_st_ctx->read_write.rx_id = cpu_to_le16(FCOE_RX_ID);
 
 	/* Ustorm ctx */
 	u_ag_ctx = &ctx->ustorm_ag_context;
@@ -151,7 +151,7 @@ int init_initiator_midpath_unsolicited_fcoe_task(
 	t_st_ctx->read_only.task_type = task_params->task_type;
 	SET_FIELD(t_st_ctx->read_write.flags,
 		  FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME, 1);
-	t_st_ctx->read_write.rx_id = cpu_to_le32(FCOE_RX_ID);
+	t_st_ctx->read_write.rx_id = cpu_to_le16(FCOE_RX_ID);
 
 	/* Init Ustorm */
 	u_ag_ctx = &ctx->ustorm_ag_context;
-- 
2.9.0

[toc] | [next] | [standalone]


#1607533

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2017-03-23 15:20 +0100
Message-ID<tobKN-3j2-11@gated-at.bofh.it>
In reply to#1604257
Arnd Bergmann <arnd@arndb.de> writes:

> gcc points out that we are converting a 16-bit integer into a 32-bit
> little-endian type and assigning that to 16-bit little-endian
> will end up with a zero:
>
> drivers/scsi/qedf/drv_fcoe_fw_funcs.c: In function 'init_initiator_rw_fcoe_task':
> include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
>   t_st_ctx->read_write.rx_id = cpu_to_le32(FCOE_RX_ID);
>
> The correct solution appears to be to just use a 16-bit byte swap instead.
>
> Fixes: be086e7c53f1 ("qed*: Utilize Firmware 8.15.3.0")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/scsi/qedf/drv_fcoe_fw_funcs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Dave: Since you queued the firmware patch, mind taking this fix through
your tree?

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [next] | [standalone]


#1607810

FromDavid Miller <davem@davemloft.net>
Date2017-03-23 20:00 +0100
Message-ID<tog7M-6nW-25@gated-at.bofh.it>
In reply to#1607533
From: "Martin K. Petersen" <martin.petersen@oracle.com>
Date: Thu, 23 Mar 2017 10:19:03 -0400

> Arnd Bergmann <arnd@arndb.de> writes:
> 
>> gcc points out that we are converting a 16-bit integer into a 32-bit
>> little-endian type and assigning that to 16-bit little-endian
>> will end up with a zero:
>>
>> drivers/scsi/qedf/drv_fcoe_fw_funcs.c: In function 'init_initiator_rw_fcoe_task':
>> include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
>>   t_st_ctx->read_write.rx_id = cpu_to_le32(FCOE_RX_ID);
>>
>> The correct solution appears to be to just use a 16-bit byte swap instead.
>>
>> Fixes: be086e7c53f1 ("qed*: Utilize Firmware 8.15.3.0")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/scsi/qedf/drv_fcoe_fw_funcs.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> Dave: Since you queued the firmware patch, mind taking this fix through
> your tree?

Ok, applied to net-next, thanks.

[toc] | [prev] | [next] | [standalone]


#1607863

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2017-03-23 21:10 +0100
Message-ID<tohdv-7lb-3@gated-at.bofh.it>
In reply to#1607810
David Miller <davem@davemloft.net> writes:

>> Dave: Since you queued the firmware patch, mind taking this fix through
>> your tree?
>
> Ok, applied to net-next, thanks.

Great, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web