All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chad Dupuis <chad.dupuis@cavium.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: QLogic-Storage-Upstream@cavium.com,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"David S. Miller" <davem@davemloft.net>,
	Ram Amrani <Ram.Amrani@cavium.com>,
	Tomer Tayar <Tomer.Tayar@cavium.com>,
	"Mintz, Yuval" <Yuval.Mintz@cavium.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] qedf: fix wrong le16 conversion
Date: Mon, 20 Mar 2017 09:40:30 -0400 (EDT)	[thread overview]
Message-ID: <alpine.OSX.2.00.1703200939390.920@administrators-macbook-pro.local> (raw)
In-Reply-To: <20170320084947.1031363-1-arnd@arndb.de>


On Mon, 20 Mar 2017, 8:49am -0000, Arnd Bergmann wrote:

> 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;
> 

Arnd, thanks for fixing this up.

Acked-by: Chad Dupuis <chad.dupuis@cavium.com>

  reply	other threads:[~2017-03-20 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20  8:49 [PATCH] qedf: fix wrong le16 conversion Arnd Bergmann
2017-03-20 13:40 ` Chad Dupuis [this message]
2017-03-23 14:19 ` Martin K. Petersen
2017-03-23 14:19   ` Martin K. Petersen
2017-03-23 18:56   ` David Miller
2017-03-23 20:07     ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.00.1703200939390.920@administrators-macbook-pro.local \
    --to=chad.dupuis@cavium.com \
    --cc=QLogic-Storage-Upstream@cavium.com \
    --cc=Ram.Amrani@cavium.com \
    --cc=Tomer.Tayar@cavium.com \
    --cc=Yuval.Mintz@cavium.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.