Skip to contentSkip to conversation

dmi update for v5.19

GIT PULL Merged Jean Delvare 4 participants 6 messages Aug 22, 2022 – Sep 7, 2022

lore
Share & tools
lore
#0 lore raw

Hi Linus,

Please pull 1 dmi subsystem update for Linux v5.19 from:

git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging.git dmi-for-linus

 drivers/firmware/dmi_scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---------------

Andy Shevchenko (1):
firmware: dmi: Use the proper accessor for the version field

Sorry for requesting a pull outside of the merge window, but I was on vacation last 2 weeks.

Thanks,

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#1 lore raw
Quoted 1 line · Jean Delvare

Please pull 1 dmi subsystem update for Linux v5.19 from:

s/v5\.19/v6.0/, of course.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#2 lore raw
In reply to Jean Delvare
Quoted 3 lines · Jean Delvare

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

#3 lore raw
Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Jean Delvare

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 concern was arisen during discussion, but my point here is that when you read the SMBus specification and look at the offset 6 the operation on it, even optimized, may confuse the reader. At least it confused me. Hence the patch.

Quoted 10 lines

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?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
In reply to Linus Torvalds

Hi Linus,

Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Jean Delvare

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.

For reference, I had the same objection originally, but Andy convinced me that code clarity was more important than a minor one-time optimization. The whole discussion can be read here:

https://lore.kernel.org/all/[email protected]/T/#mf41d04beeb1d4fddadf77248eec8be397f77cdb5

Quoted 10 lines

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?

Thanks for taking the time to look into this. You have a point.

It doesn't utterly matter in practice because it's hard to imagine that the checksum would be correct if the size is not. The check for size < 32 is to avoid a walking past the end of the buffer if the entry point is incorrect or corrupted. Every other case of incorrectness or corruption is assumed to be caught by the checksum itself.

I suppose that the lack of a check for a minimum size comes from the fact that the legacy DMI entry point did not even have a size field. As a matter of fact, dmidecode does not have a minimum entry point size check either.

I can add a minimum entry size check if you want. Some extra robustness can't hurt.

Thanks,

Signature · 2 lines
Jean Delvare
SUSE L3 Support
merge bot Merged
#5 lore raw
In reply to Jean Delvare
The pull request you sent on Mon, 22 Aug 2022 14:19:30 +0200:

The pull request you sent on Mon, 22 Aug 2022 14:19:30 +0200:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging.git dmi-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e78bf8cbf005c3cc7dc4da55ce75152b71a1da0f

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html