Skip to contentSkip to conversation

ocfs2/dlm: fix a variable overflow problem in dlmdomain.c

PATCH New piaojun 2 participants 2 messages Mar 14, 2016 OCFS2

lore
Share & tools
lore

piaojun

author
#0 lore raw

PATCH v2 1/1 ocfs2/dlm: fix a variable overflow problem in dlmdomain.c

In dlm_send_join_cancels(), node is defined with type unsigned int, but initialized with -1, this will lead variable overflow. Although this won't cause any runtime problem, the code looks a little uncoordinated.

---
 dlm/dlmdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dlm/dlmdomain.c +1 -1
index 2ee7fe7..8cbf6e8 100644
@@ -1396,7 +1396,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm,
 				 unsigned int map_size)
 {
 	int status, tmpstat;
-	unsigned int node;
+	int node;
 
 	if (map_size != (BITS_TO_LONGS(O2NM_MAX_NODES) *
 			 sizeof(unsigned long))) {
Signature · 1 line
1.8.4.3
#1 lore raw

PATCH v2 1/1 ocfs2/dlm: fix a variable overflow problem in dlmdomain.c

Quoted 5 lines · piaojun

In dlm_send_join_cancels(), node is defined with type unsigned int, but initialized with -1, this will lead variable overflow. Although this won't cause any runtime problem, the code looks a little uncoordinated.

Thanks, Jun.

Quoted 18 lines
---
 dlm/dlmdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dlm/dlmdomain.c +1 -1
index 2ee7fe7..8cbf6e8 100644
@@ -1396,7 +1396,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm,
 				 unsigned int map_size)
 {
 	int status, tmpstat;
-	unsigned int node;
+	int node;
 
 	if (map_size != (BITS_TO_LONGS(O2NM_MAX_NODES) *
 			 sizeof(unsigned long))) {