* [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks
@ 2021-09-17 21:23 Bart Van Assche
2021-09-18 7:12 ` Damien Le Moal
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Bart Van Assche @ 2021-09-17 21:23 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Johannes Thumshirn, Damien Le Moal,
Hannes Reinecke
This patch addresses the following Coverity report about the
zno * sdkp->zone_blocks expression:
CID 1475514 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression zno *
sdkp->zone_blocks with type unsigned int (32 bits, unsigned) is evaluated
using 32-bit arithmetic, and then used in a context that expects an
expression of type sector_t (64 bits, unsigned).
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>
Cc: Hannes Reinecke <hare@suse.de>
Fixes: 5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/sd_zbc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index b9757f24b0d6..ded4d7a070a0 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -280,7 +280,7 @@ static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
{
struct scsi_disk *sdkp;
unsigned long flags;
- unsigned int zno;
+ sector_t zno;
int ret;
sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks
2021-09-17 21:23 [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks Bart Van Assche
@ 2021-09-18 7:12 ` Damien Le Moal
2021-09-19 8:14 ` Hannes Reinecke
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2021-09-18 7:12 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, Johannes Thumshirn, Hannes Reinecke
On 2021/09/18 6:23, Bart Van Assche wrote:
> This patch addresses the following Coverity report about the
> zno * sdkp->zone_blocks expression:
>
> CID 1475514 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
> overflow_before_widen: Potentially overflowing expression zno *
> sdkp->zone_blocks with type unsigned int (32 bits, unsigned) is evaluated
> using 32-bit arithmetic, and then used in a context that expects an
> expression of type sector_t (64 bits, unsigned).
>
> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Cc: Damien Le Moal <Damien.LeMoal@wdc.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Fixes: 5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/sd_zbc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index b9757f24b0d6..ded4d7a070a0 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -280,7 +280,7 @@ static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
> {
> struct scsi_disk *sdkp;
> unsigned long flags;
> - unsigned int zno;
> + sector_t zno;
> int ret;
>
> sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
>
Looks good.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks
2021-09-17 21:23 [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks Bart Van Assche
2021-09-18 7:12 ` Damien Le Moal
@ 2021-09-19 8:14 ` Hannes Reinecke
2021-09-20 7:22 ` Johannes Thumshirn
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2021-09-19 8:14 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, Johannes Thumshirn, Damien Le Moal
On 9/17/21 11:23 PM, Bart Van Assche wrote:
> This patch addresses the following Coverity report about the
> zno * sdkp->zone_blocks expression:
>
> CID 1475514 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
> overflow_before_widen: Potentially overflowing expression zno *
> sdkp->zone_blocks with type unsigned int (32 bits, unsigned) is evaluated
> using 32-bit arithmetic, and then used in a context that expects an
> expression of type sector_t (64 bits, unsigned).
>
> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Cc: Damien Le Moal <Damien.LeMoal@wdc.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Fixes: 5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/sd_zbc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index b9757f24b0d6..ded4d7a070a0 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -280,7 +280,7 @@ static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
> {
> struct scsi_disk *sdkp;
> unsigned long flags;
> - unsigned int zno;
> + sector_t zno;
> int ret;
>
> sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
>
Of course.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks
2021-09-17 21:23 [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks Bart Van Assche
2021-09-18 7:12 ` Damien Le Moal
2021-09-19 8:14 ` Hannes Reinecke
@ 2021-09-20 7:22 ` Johannes Thumshirn
2021-09-20 14:04 ` Himanshu Madhani
2021-09-22 4:44 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2021-09-20 7:22 UTC (permalink / raw)
To: Bart Van Assche, Martin K . Petersen
Cc: linux-scsi, Damien Le Moal, Hannes Reinecke
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks
2021-09-17 21:23 [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks Bart Van Assche
` (2 preceding siblings ...)
2021-09-20 7:22 ` Johannes Thumshirn
@ 2021-09-20 14:04 ` Himanshu Madhani
2021-09-22 4:44 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Himanshu Madhani @ 2021-09-20 14:04 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin Petersen, linux-scsi, Johannes Thumshirn, Damien Le Moal,
Hannes Reinecke
> On Sep 17, 2021, at 4:23 PM, Bart Van Assche <bvanassche@acm.org> wrote:
>
> This patch addresses the following Coverity report about the
> zno * sdkp->zone_blocks expression:
>
> CID 1475514 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
> overflow_before_widen: Potentially overflowing expression zno *
> sdkp->zone_blocks with type unsigned int (32 bits, unsigned) is evaluated
> using 32-bit arithmetic, and then used in a context that expects an
> expression of type sector_t (64 bits, unsigned).
>
> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Cc: Damien Le Moal <Damien.LeMoal@wdc.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Fixes: 5795eb443060 ("scsi: sd_zbc: emulate ZONE_APPEND commands")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/scsi/sd_zbc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index b9757f24b0d6..ded4d7a070a0 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -280,7 +280,7 @@ static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
> {
> struct scsi_disk *sdkp;
> unsigned long flags;
> - unsigned int zno;
> + sector_t zno;
> int ret;
>
> sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
Looks Good.
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
--
Himanshu Madhani Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks
2021-09-17 21:23 [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks Bart Van Assche
` (3 preceding siblings ...)
2021-09-20 14:04 ` Himanshu Madhani
@ 2021-09-22 4:44 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-09-22 4:44 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, Johannes Thumshirn, linux-scsi,
Damien Le Moal, Hannes Reinecke
On Fri, 17 Sep 2021 14:23:14 -0700, Bart Van Assche wrote:
> This patch addresses the following Coverity report about the
> zno * sdkp->zone_blocks expression:
>
> CID 1475514 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
> overflow_before_widen: Potentially overflowing expression zno *
> sdkp->zone_blocks with type unsigned int (32 bits, unsigned) is evaluated
> using 32-bit arithmetic, and then used in a context that expects an
> expression of type sector_t (64 bits, unsigned).
>
> [...]
Applied to 5.15/scsi-fixes, thanks!
[1/1] scsi: sd_zbc: Support disks with more than 2**32 logical blocks
https://git.kernel.org/mkp/scsi/c/1d479e6c9cb2
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-09-22 4:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 21:23 [PATCH] scsi: sd_zbc: Support disks with more than 2**32 logical blocks Bart Van Assche
2021-09-18 7:12 ` Damien Le Moal
2021-09-19 8:14 ` Hannes Reinecke
2021-09-20 7:22 ` Johannes Thumshirn
2021-09-20 14:04 ` Himanshu Madhani
2021-09-22 4:44 ` Martin K. Petersen
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.