Skip to content

Commit bb958d5

Browse files
benreese0keithbusch
authored andcommitted
Fixing Alignment Error In intel smart-log-add
Fixing alignment in nvme_additional_smart_log_item introduced by switch from '#pragma pack' semantics to '__attribute__((pack))'. Per https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html each union or struct requires it's own '__attribute__((pack))'. Signed-off-by: Ben Reese <[email protected]>
1 parent 69b6b28 commit bb958d5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

plugins/intel/intel-nvme.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@
2020
#define CREATE_CMD
2121
#include "intel-nvme.h"
2222

23-
struct nvme_additional_smart_log_item {
23+
struct __attribute__((packed)) nvme_additional_smart_log_item {
2424
__u8 key;
2525
__u8 _kp[2];
2626
__u8 norm;
2727
__u8 _np;
28-
union {
28+
union __attribute__((packed)) {
2929
__u8 raw[6];
30-
struct wear_level {
30+
struct __attribute__((packed)) wear_level {
3131
__le16 min;
3232
__le16 max;
3333
__le16 avg;
3434
} wear_level;
35-
struct thermal_throttle {
35+
struct __attribute__((packed)) thermal_throttle {
3636
__u8 pct;
3737
__u32 count;
3838
} thermal_throttle;
39-
};
39+
} ;
4040
__u8 _rp;
41-
} __attribute__((packed));
41+
} ;
4242

4343
struct nvme_additional_smart_log {
4444
struct nvme_additional_smart_log_item program_fail_cnt;

0 commit comments

Comments
 (0)