From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alasdair Kergon <agk@redhat.com>, Damien Le Moal <damien.lemoal@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.com>,
Mike Snitzer <snitzer@redhat.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Greg Edwards <gedwards@ddn.com>,
kernel-janitors@vger.kernel.org, Ming Lei <ming.lei@redhat.com>,
linux-block@vger.kernel.org, dm-devel@redhat.com,
Omar Sandoval <osandov@fb.com>,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH v2] dm zoned: Silence a static checker warning
Date: Wed, 10 Apr 2019 10:47:35 +0300 [thread overview]
Message-ID: <20190410074735.GA28842@kadam> (raw)
In-Reply-To: <BYAPR04MB5816CFE5C37FABB137D496DEE72E0@BYAPR04MB5816.namprd04.prod.outlook.com>
My static checker complains about this line from dmz_get_zoned_device()
aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
The problem is that "aligned_capacity" and "dev->capacity" are sector_t
type (which is a u64) but blk_queue_zone_sectors(q) returns a u32 so the
higher 32 bits in "aligned_capacity" are always cleared to zero. This
patch adds a cast to u64 to address this issue.
Fixes: 114e025968b5 ("dm zoned: ignore last smaller runt zone")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: In v1 I changed blk_queue_zone_sectors() to return a sector_t type,
but in v2 I just add a cast. The v2 fix would end up going through
different maintainers and reviewers so the CC list has grown...
Original discussion: https://marc.info/?l=kernel-janitors&m=155487663405737&w=2
drivers/md/dm-zoned-target.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index 8865c1709e16..b6cb44fa946d 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -643,7 +643,8 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path)
q = bdev_get_queue(dev->bdev);
dev->capacity = i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT;
- aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
+ aligned_capacity = dev->capacity &
+ ~((u64)blk_queue_zone_sectors(q) - 1);
if (ti->begin ||
((ti->len != dev->capacity) && (ti->len != aligned_capacity))) {
ti->error = "Partial mapping not supported";
--
2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alasdair Kergon <agk@redhat.com>, Damien Le Moal <damien.lemoal@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.com>,
Mike Snitzer <snitzer@redhat.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Greg Edwards <gedwards@ddn.com>,
kernel-janitors@vger.kernel.org, Ming Lei <ming.lei@redhat.com>,
linux-block@vger.kernel.org, dm-devel@redhat.com,
Omar Sandoval <osandov@fb.com>,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH v2] dm zoned: Silence a static checker warning
Date: Wed, 10 Apr 2019 07:47:35 +0000 [thread overview]
Message-ID: <20190410074735.GA28842@kadam> (raw)
In-Reply-To: <BYAPR04MB5816CFE5C37FABB137D496DEE72E0@BYAPR04MB5816.namprd04.prod.outlook.com>
My static checker complains about this line from dmz_get_zoned_device()
aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
The problem is that "aligned_capacity" and "dev->capacity" are sector_t
type (which is a u64) but blk_queue_zone_sectors(q) returns a u32 so the
higher 32 bits in "aligned_capacity" are always cleared to zero. This
patch adds a cast to u64 to address this issue.
Fixes: 114e025968b5 ("dm zoned: ignore last smaller runt zone")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: In v1 I changed blk_queue_zone_sectors() to return a sector_t type,
but in v2 I just add a cast. The v2 fix would end up going through
different maintainers and reviewers so the CC list has grown...
Original discussion: https://marc.info/?l=kernel-janitors&m\x155487663405737&w=2
drivers/md/dm-zoned-target.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index 8865c1709e16..b6cb44fa946d 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -643,7 +643,8 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path)
q = bdev_get_queue(dev->bdev);
dev->capacity = i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT;
- aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
+ aligned_capacity = dev->capacity &
+ ~((u64)blk_queue_zone_sectors(q) - 1);
if (ti->begin ||
((ti->len != dev->capacity) && (ti->len != aligned_capacity))) {
ti->error = "Partial mapping not supported";
--
2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alasdair Kergon <agk@redhat.com>, Damien Le Moal <damien.lemoal@wdc.com>
Cc: Mike Snitzer <snitzer@redhat.com>,
dm-devel@redhat.com, kernel-janitors@vger.kernel.org,
Hannes Reinecke <hare@suse.com>, Omar Sandoval <osandov@fb.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Bart Van Assche <bvanassche@acm.org>,
Ming Lei <ming.lei@redhat.com>, Greg Edwards <gedwards@ddn.com>,
linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH v2] dm zoned: Silence a static checker warning
Date: Wed, 10 Apr 2019 10:47:35 +0300 [thread overview]
Message-ID: <20190410074735.GA28842@kadam> (raw)
In-Reply-To: <BYAPR04MB5816CFE5C37FABB137D496DEE72E0@BYAPR04MB5816.namprd04.prod.outlook.com>
My static checker complains about this line from dmz_get_zoned_device()
aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
The problem is that "aligned_capacity" and "dev->capacity" are sector_t
type (which is a u64) but blk_queue_zone_sectors(q) returns a u32 so the
higher 32 bits in "aligned_capacity" are always cleared to zero. This
patch adds a cast to u64 to address this issue.
Fixes: 114e025968b5 ("dm zoned: ignore last smaller runt zone")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: In v1 I changed blk_queue_zone_sectors() to return a sector_t type,
but in v2 I just add a cast. The v2 fix would end up going through
different maintainers and reviewers so the CC list has grown...
Original discussion: https://marc.info/?l=kernel-janitors&m=155487663405737&w=2
drivers/md/dm-zoned-target.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index 8865c1709e16..b6cb44fa946d 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -643,7 +643,8 @@ static int dmz_get_zoned_device(struct dm_target *ti, char *path)
q = bdev_get_queue(dev->bdev);
dev->capacity = i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT;
- aligned_capacity = dev->capacity & ~(blk_queue_zone_sectors(q) - 1);
+ aligned_capacity = dev->capacity &
+ ~((u64)blk_queue_zone_sectors(q) - 1);
if (ti->begin ||
((ti->len != dev->capacity) && (ti->len != aligned_capacity))) {
ti->error = "Partial mapping not supported";
--
2.17.1
next prev parent reply other threads:[~2019-04-10 7:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 6:10 [PATCH] block: make blk_queue_zone_sectors() return sector_t type Dan Carpenter
2019-04-10 6:10 ` Dan Carpenter
2019-04-10 7:20 ` Damien Le Moal
2019-04-10 7:31 ` Dan Carpenter
2019-04-10 7:31 ` Dan Carpenter
2019-04-10 7:47 ` Dan Carpenter [this message]
2019-04-10 7:47 ` [PATCH v2] dm zoned: Silence a static checker warning Dan Carpenter
2019-04-10 7:47 ` Dan Carpenter
2019-04-10 7:56 ` Damien Le Moal
2019-04-10 7:56 ` Damien Le Moal
2019-04-10 8:03 ` Dan Carpenter
2019-04-10 8:03 ` Dan Carpenter
2019-04-10 8:03 ` Dan Carpenter
2019-04-10 8:06 ` Damien Le Moal
2019-04-10 8:06 ` [dm-devel] " Damien Le Moal
2019-04-10 8:12 ` [PATCH v3] " Dan Carpenter
2019-04-10 8:12 ` Dan Carpenter
2019-04-10 8:12 ` Dan Carpenter
2019-04-10 8:14 ` Damien Le Moal
2019-04-10 8:14 ` Damien Le Moal
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=20190410074735.GA28842@kadam \
--to=dan.carpenter@oracle.com \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=damien.lemoal@wdc.com \
--cc=dm-devel@redhat.com \
--cc=gedwards@ddn.com \
--cc=hare@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=osandov@fb.com \
--cc=snitzer@redhat.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.