opensm/osm_helper.c: fix potential overrun of the array
PATCH 1/1 opensm/osm_helper.c: fix potential overrun of the array
Max index of the ib_sm_method_str[] static array
is 0x20. Fixing OSM_SM_METHOD_STR_UNKNOWN_VAL to
match this value.
--- opensm/opensm/osm_helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
opensm/opensm/osm_helper.c +1 -1
@@ -148,7 +148,7 @@ static const char *ib_sm_method_str[] = {"UNKNOWN" /* 20 */ }; -#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21 +#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x20static const char *ib_sm_attr_str[] = {"RESERVED" ,/* 0 */
Signature · 6 lines
1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 4C865419.9050005-VPRAkNaXOzVS1MOuV/[email protected]
Sasha Khapyorsky
AppliedQuoted 5 lines · Yevgeny Kliteynik
Max index of the ib_sm_method_str[] static array
is0x20. FixingOSM_SM_METHOD_STR_UNKNOWN_VALto
match this value.Signed-off-by Yevgeny Kliteynik <[email protected]>
Applied. Thanks.
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Yevgeny Kliteynik
Max index of the ib_sm_method_str[] static array
is0x20. FixingOSM_SM_METHOD_STR_UNKNOWN_VALto
match this value.Signed-off-by Yevgeny Kliteynik <[email protected]>--- opensm/opensm/osm_helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)opensm/opensm/osm_helper.c +0
-0
opensm/opensm/osm_helper.c static const char *ib_sm_method_str[] = { · line 151
Quoted 5 lines
opensm/opensm/osm_helper.c +1
-1@@ -148,7 +148,7 @@ static const char *ib_sm_method_str[] = { "UNKNOWN" /* 20 */ }; -#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21 +#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x20
BTW, wouldn't it be better to use ARR_SIZE macro for those defines:
#define OSM_SM_METHOD_STR_UNKNOWN_VAL ARR_SIZE(ib_sm_method_str)
, where:
#define ARR_SIZE(a) (sizeof(a)/sizeof(a[0]))
?
Sasha
Quoted 6 lines
opensm/opensm/osm_helper.c +0
-0static const char *ib_sm_attr_str[] = {"RESERVED" ,/* 0 */ Signature · 1 line
1.6.2.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 18 lines · Sasha Khapyorsky
Quoted 17 lines · Yevgeny Kliteynik
Max index of the ib_sm_method_str[] static array
is0x20. FixingOSM_SM_METHOD_STR_UNKNOWN_VALto
match this value.Signed-off-by Yevgeny Kliteynik<[email protected]>--- opensm/opensm/osm_helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)opensm/opensm/osm_helper.c +0
-0@@ -148,7 +148,7 @@ static const char *ib_sm_method_str[] = { "UNKNOWN" /* 20 */ };
Quoted 6 lines
opensm/opensm/osm_helper.c static const char *ib_sm_method_str[] = { · line 151
Quoted 2 lines
opensm/opensm/osm_helper.c +1
-1-#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21 +#define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x20BTW, wouldn't it be better to use
ARR_SIZEmacro for those defines:#define
OSM_SM_METHOD_STR_UNKNOWN_VALARR_SIZE(ib_sm_method_str)
Good idea, with a small fix:
#define OSM_SM_METHOD_STR_UNKNOWN_VAL (ARR_SIZE(ib_sm_method_str) - 1)
-- Yevgeny
Quoted 15 lines
, where:
#define
ARR_SIZE(a)(sizeof(a)/sizeof(a[0]))?
Sasha
Quoted 6 lines
opensm/opensm/osm_helper.c +0
-0static const char *ib_sm_attr_str[] = {"RESERVED" ,/* 0 */ Signature · 1 line
1.6.2.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html