[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2R+5kLx=Fo2GTRagAk+4dPP-8GDfH9X7gCtQ7R8=bK_g@mail.gmail.com>
Date: Fri, 26 Oct 2018 10:16:54 +0200
From: Arnd Bergmann <arnd@...db.de>
To: James.Bottomley@...senpartnership.com,
Hannes Reinecke <hare@...e.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-scsi <linux-scsi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Christoph Hellwig <hch@...radead.org>
Subject: scsi: myrs: warning fix, was: [GIT PULL] first round of SCSI updates
for the 4.19+ merge window
On Wed, Oct 24, 2018 at 1:00 PM James Bottomley
<James.Bottomley@...senpartnership.com> wrote:
>
> James Bottomley (1):
> scsi: myrs: fix build failure on 32 bit
Hi James and Hannes,
Since James mentioned 32-bit compiles during the kernel summit,
I'd like to confirm that I hit this on my randconfig builder now,
with some latency since the last linux-next tree I tested before
flying to Edinburgh did not have the bug, and the latest
linux-next tree that is available now (dated last Friday) does, and
I see your tree is fixed. During normal times, I should catch these
within a short time of the patch getting into scsi-next.
However, while looking at this bug, I found two more issues related
to the specific computation:
percent_complete = ldev_info->rbld_lba * 100 / ldev_info->cfg_devsize;
I see that both rbld_lba and cfg_devsize are reported by the
device, but only the former is 64 bit but the latter is 32 bit and
also intended to be the larger of the two. I suspect this is a
bug, and the same is also present in the old DAC960.c.
cfg_devsize is followed by four reserved bytes in the header,
so I suppose it was meant to be 64-bit?
If you divide two 64-bit numbers, you also have to use div_u64_64()
instead of do_div().
On top of that, I see we get those values from the device but
never do any endianess conversion on them. It seems likely
that they are all little-endian and require a le32_to_cpu()
conversion to also work on big-endian kernel builds. Alternatively
we could make the Kconfig symbol as
'depends on !CPU_BIG_ENDIAN || COMPILE_TEST'.
Arnd
Powered by blists - more mailing lists