Skip to content

Commit

Permalink
qedf: fix wrong le16 conversion
Browse files Browse the repository at this point in the history
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: be086e7 ("qed*: Utilize Firmware 8.15.3.0")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arnd Bergmann authored and David S. Miller committed Mar 23, 2017
1 parent 028ba8a commit 6f359f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/scsi/qedf/drv_fcoe_fw_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6f359f9

Please sign in to comment.