Commit 468e60f
nvme: Fix get-feature on big-endian systems
The `parse_and_open()` function uses `OPT_BYTE` to parse the
feature_id and sel options. This means it writes a single byte
to the memory locations for `feature_id` and `sel` in the `feat_cfg`
struct.
However, these fields were declared as `enum`, which typically has
the size of an `int`. On big-endian architectures, writing a single
byte to the address of an `int` modifies the most significant byte,
resulting in an incorrect value being read. This caused the
`get-feature` command to fail. The command only worked on little-endian
systems.
Fix the issue by changing the type for `feature_id`
and `sel` to `__u8`. This ensures the fields are treated as single
bytes, guaranteeing correct behavior on all architectures.
Signed-off-by: Maurizio Lombardi <[email protected]>1 parent 0d4aaa3 commit 468e60f
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
76 | 77 | | |
77 | | - | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
0 commit comments