Skip to content
Snippets Groups Projects
Commit e27cd679 authored by Kees Bakker's avatar Kees Bakker Committed by Greg Kroah-Hartman
Browse files

staging: gpib: avoid unintended sign extension


The code was basically like this (assuming size_t can be u64)
    var_u64 |= var_u8 << 24
var_u8 is first promoted to i32 and then the shift is done. Next, it is
promoted to u64 by first signextending to 64 bits. This is very unlikely
what was intended. So now it is first forced to u32.
    var_u64 |= (u32)var_u8 << 24

This was detected by Coverity, CID 1600792.

Fixes: 4c41fe88 ("staging: gpib: Add Agilent/Keysight 82357x USB GPIB driver")
Signed-off-by: default avatarKees Bakker <kees@ijzerbout.nl>
Link: https://lore.kernel.org/r/20241108201207.1194F18DDF5@bout3.ijzerbout.nl


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 73453164
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment