From: Arnd Bergmann <arnd@kernel.org>
To: Song Liu <song@kernel.org>, Yu Kuai <yukuai3@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Jens Axboe <axboe@kernel.dk>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] md/raid1-10: shut up randstruct warning again
Date: Fri, 16 Jun 2023 11:24:48 +0200 [thread overview]
Message-ID: <20230616092532.3307719-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
A code reorganization brought back a warning when structure randomization
is enabled:
drivers/md/raid1-10.c:119:25: error: casting from randomized structure pointer type 'struct block_device *' to 'struct md_rdev *'
struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev;
^
Before the rework, this used a (void*) cast, so go back to that in order
to avoid the warning. Casting between pointers to incompatible types is
clearly something that is dangerous, but this driver has always done so,
and it's not made any worse by the struct randomization in this case.
Fixes: 8295efbe68c08 ("md/raid1-10: factor out a helper to submit normal write")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/md/raid1-10.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
index 169ebe296f2d0..3f22edec70e78 100644
--- a/drivers/md/raid1-10.c
+++ b/drivers/md/raid1-10.c
@@ -116,7 +116,7 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
static inline void raid1_submit_write(struct bio *bio)
{
- struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev;
+ struct md_rdev *rdev = (void *)bio->bi_bdev;
bio->bi_next = NULL;
bio_set_dev(bio, rdev->bdev);
--
2.39.2
next reply other threads:[~2023-06-16 9:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 9:24 Arnd Bergmann [this message]
2023-06-16 9:30 ` Yu Kuai
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=20230616092532.3307719-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@opensource.wdc.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=yukuai3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®