sfc: EFX_ETHTOOL_STAT calculates the offset of the efx##source_name's field in both cases
Subsystems (2)
PATCH 1/1 sfc: EFX_ETHTOOL_STAT calculates the offset of the efx##source_name's field in both cases
EFX_ETHTOOL_STAT calculated the offset of the efx##source_name's field Regardless of whether that field was NULL.
Signed-off-by Roel Kluin <[email protected]>
---
This looks like a bug, but I am not sure whether I understood this correctly, nor was it tested, was this intended?
drivers/net/sfc/ethtool.c +1 -1
@@ -41,7 +41,7 @@ struct efx_ethtool_stat { .source = EFX_ETHTOOL_STAT_SOURCE_##source_name, \ .offset = ((((field_type *) 0) == \ &((struct efx_##source_name *)0)->field) ? \ - offsetof(struct efx_##source_name, field) : \ + offsetof(struct efx_##stat_name, field) : \ offsetof(struct efx_##source_name, field)), \ .get_stat = get_stat_function, \ }
Quoted 7 lines · Roel Kluin
EFX_ETHTOOL_STATcalculated the offset of the efx##source_name's field Regardless of whether that field was NULL.Signed-off-by Roel Kluin <[email protected]>---
This looks like a bug, but I am not sure whether I understood this correctly, nor was it tested, was this intended?
The condition is really a type check. The result should be the same regardless of whether it is true.
Ben.
Quoted 13 lines
drivers/net/sfc/ethtool.c +1
-1@@ -41,7 +41,7 @@ struct efx_ethtool_stat { .source = EFX_ETHTOOL_STAT_SOURCE_##source_name, \ .offset = ((((field_type *) 0) == \ &((struct efx_##source_name *)0)->field) ? \ - offsetof(struct efx_##source_name, field) : \ + offsetof(struct efx_##stat_name, field) : \ offsetof(struct efx_##source_name, field)), \ .get_stat = get_stat_function, \ }
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.