Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
	Song Liu <song@kernel.org>
Cc: Logan Gunthorpe <logang@deltatee.com>, kernel test robot <lkp@intel.com>
Subject: [PATCH] md/raid5: Fix divide type in raid5_make_request()
Date: Thu, 23 Jun 2022 10:55:52 -0600	[thread overview]
Message-ID: <20220623165552.38645-1-logang@deltatee.com> (raw)

0day reports a build failure on the hexagon architecture:

  ld.lld: error: undefined symbol: __hexagon_udivdi3
     referenced by raid5.c
        md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
     referenced by raid5.c
        md/raid5.o:(raid5_make_request) in archive drivers/built-in.a
     did you mean: __hexagon_udivsi3
        defined in: arch/hexagon/built-in.a(lib/udivsi3.o)

This is caused by using DIV_ROUND_UP on a sector_t type.

The actual value is known to be less than 256 so a wide 64bit divide
here is not desirable. Thus cast the argument to an int to ensure it
uses a 32bit divide.

Fixes: 681fb14a7100 ("md/raid5: Pivot raid5_make_request()")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
 drivers/md/raid5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5723a497108a..9d25696b793d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6091,7 +6091,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)
 	bi->bi_next = NULL;
 
 	bitmap_set(ctx.sectors_to_do, 0,
-		   DIV_ROUND_UP(ctx.last_sector - logical_sector,
+		   DIV_ROUND_UP((int)(ctx.last_sector - logical_sector),
 				RAID5_STRIPE_SECTORS(conf)));
 
 	pr_debug("raid456: %s, logical %llu to %llu\n", __func__,

base-commit: 57c19f921f8081c1a9444dc7f3f6b3ea43fe612e
-- 
2.30.2


             reply	other threads:[~2022-06-23 17:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 16:55 Logan Gunthorpe [this message]
2022-06-23 17:15 ` [PATCH] md/raid5: Fix divide type in raid5_make_request() Song Liu
2022-06-23 17:18   ` Logan Gunthorpe

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=20220623165552.38645-1-logang@deltatee.com \
    --to=logang@deltatee.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=song@kernel.org \
    /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