public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] cxlflash: shift wrapping bug in afu_link_reset()
@ 2015-08-18  8:57 Dan Carpenter
  2015-08-18  9:58 ` Johannes Thumshirn
  2015-08-18 15:11 ` Matthew R. Ochs
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-08-18  8:57 UTC (permalink / raw)
  To: James E.J. Bottomley, Matthew R. Ochs
  Cc: Manoj N. Kumar, Brian King, Michael Neuling, linux-scsi,
	kernel-janitors

"port_sel" is a u64 so the shifting should also be a 64 bit shift.

Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index 0720d2f..f97421d 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -1179,7 +1179,7 @@ static void afu_link_reset(struct afu *afu, int port, u64 *fc_regs)
 
 	/* first switch the AFU to the other links, if any */
 	port_sel = readq_be(&afu->afu_map->global.regs.afu_port_sel);
-	port_sel &= ~(1 << port);
+	port_sel &= ~(1ULL << port);
 	writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel);
 	cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC);
 
@@ -1196,7 +1196,7 @@ static void afu_link_reset(struct afu *afu, int port, u64 *fc_regs)
 		       __func__, port);
 
 	/* switch back to include this port */
-	port_sel |= (1 << port);
+	port_sel |= (1ULL << port);
 	writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel);
 	cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] cxlflash: shift wrapping bug in afu_link_reset()
  2015-08-18  8:57 [patch] cxlflash: shift wrapping bug in afu_link_reset() Dan Carpenter
@ 2015-08-18  9:58 ` Johannes Thumshirn
  2015-08-18 15:11 ` Matthew R. Ochs
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2015-08-18  9:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James E.J. Bottomley, Matthew R. Ochs, Manoj N. Kumar, Brian King,
	Michael Neuling, linux-scsi, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> writes:

> "port_sel" is a u64 so the shifting should also be a 64 bit shift.
>
> Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
> index 0720d2f..f97421d 100644
> --- a/drivers/scsi/cxlflash/main.c
> +++ b/drivers/scsi/cxlflash/main.c
> @@ -1179,7 +1179,7 @@ static void afu_link_reset(struct afu *afu, int port, u64 *fc_regs)
>  
>  	/* first switch the AFU to the other links, if any */
>  	port_sel = readq_be(&afu->afu_map->global.regs.afu_port_sel);
> -	port_sel &= ~(1 << port);
> +	port_sel &= ~(1ULL << port);
>  	writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel);
>  	cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC);
>  
> @@ -1196,7 +1196,7 @@ static void afu_link_reset(struct afu *afu, int port, u64 *fc_regs)
>  		       __func__, port);
>  
>  	/* switch back to include this port */
> -	port_sel |= (1 << port);
> +	port_sel |= (1ULL << port);
>  	writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel);
>  	cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC);
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                           Storage
jthumshirn@suse.de                                 +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600  D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] cxlflash: shift wrapping bug in afu_link_reset()
  2015-08-18  8:57 [patch] cxlflash: shift wrapping bug in afu_link_reset() Dan Carpenter
  2015-08-18  9:58 ` Johannes Thumshirn
@ 2015-08-18 15:11 ` Matthew R. Ochs
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew R. Ochs @ 2015-08-18 15:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James E.J. Bottomley, Manoj N. Kumar, Brian King, Michael Neuling,
	linux-scsi, kernel-janitors

> On Aug 18, 2015, at 3:57 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> "port_sel" is a u64 so the shifting should also be a 64 bit shift.
> 
> Fixes: c21e0bbfc485 ('cxlflash: Base support for IBM CXL Flash Adapter')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
> index 0720d2f..f97421d 100644
> --- a/drivers/scsi/cxlflash/main.c
> +++ b/drivers/scsi/cxlflash/main.c
> @@ -1179,7 +1179,7 @@ static void afu_link_reset(struct afu *afu, int port, u64 *fc_regs)
> 
> 	/* first switch the AFU to the other links, if any */
> 	port_sel = readq_be(&afu->afu_map->global.regs.afu_port_sel);
> -	port_sel &= ~(1 << port);
> +	port_sel &= ~(1ULL << port);
> 	writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel);
> 	cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC);
> 
> @@ -1196,7 +1196,7 @@ static void afu_link_reset(struct afu *afu, int port, u64 *fc_regs)
> 		       __func__, port);
> 
> 	/* switch back to include this port */
> -	port_sel |= (1 << port);
> +	port_sel |= (1ULL << port);
> 	writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel);
> 	cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC);
> 

Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-18 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-18  8:57 [patch] cxlflash: shift wrapping bug in afu_link_reset() Dan Carpenter
2015-08-18  9:58 ` Johannes Thumshirn
2015-08-18 15:11 ` Matthew R. Ochs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox