Re: [GIT PULL] dmi update for v5.19

From: Linus Torvalds
Date: Wed Aug 24 2022 - 13:32:02 EST


On Mon, Aug 22, 2022 at 5:19 AM Jean Delvare <jdelvare@xxxxxxx> wrote:
>
> Andy Shevchenko (1):
> firmware: dmi: Use the proper accessor for the version field

I pulled this, but I kind of question it.

This replaces a single 32-bit memory access (and an optimized byte
swap) and a mask operation with three load-byte-and-shift operations.

It's not clear that the new code is better.

That said, I can't imagine it matters - but because I looked at it, I
note that the length check seems to be kind of iffy.

The code checks that the length of the block is < 32 before doing the
checksum on it, but shouldn't it also check for some minimum size?
Otherwise the dmi checksum is kind of pointless, isn't it?

It will access a minimum of 24 bytes for that dmi_base thing, so that
would be the most obvious minimum value. But maybe there is some
spec-defined size for that that only covers the header?

Linus