Skip to content

Commit 6fef6ae

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: ethtool: fix wrong type used in struct kernel_ethtool_ts_info
In C, enumerated types do not have a defined size, apart from being compatible with one of the standard types. This allows an ABI / compiler to choose the type of an enum depending on the values it needs to store, and storing larger values in it can lead to undefined behaviour. The tx_type and rx_filters members of struct kernel_ethtool_ts_info are defined as enumerated types, but are bit arrays, where each bit is defined by the enumerated type. This means they typically store values in excess of the maximum value of the enumerated type, in fact (1 << max_value) and thus must not be declared using the enumated type. Fix both of these to use u32, as per the corresponding __u32 UAPI type. Fixes: 2111375 ("net: Add struct kernel_ethtool_ts_info") Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Kory Maincent <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 78dd8ad commit 6fef6ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/ethtool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,8 @@ struct kernel_ethtool_ts_info {
856856
enum hwtstamp_provider_qualifier phc_qualifier;
857857
enum hwtstamp_source phc_source;
858858
int phc_phyindex;
859-
enum hwtstamp_tx_types tx_types;
860-
enum hwtstamp_rx_filters rx_filters;
859+
u32 tx_types;
860+
u32 rx_filters;
861861
};
862862

863863
/**

0 commit comments

Comments
 (0)