Skip to contentSkip to conversation

: Supress a `comparison is always false' warning in fs/cifs/asn1.c

PATCH Steve French 1 participant 1 message Jun 22, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Chris,
Although this check seems harmless, shrinking the range to uint from ulong makes sense as Suresh suggested and I was planning on adding this to the cifs-2.6.git tree - but was not sure if you would prefer to change both locations at once.

Quoted 24 lines · Suresh Jayaraman

On x86_64, I get this warning:

fs/cifs/asn1.c: In function `asn1_oid_decode':
fs/cifs/asn1.c:403: warning: comparison is always false due to limited range of data type

---

fs/cifs/asn1.c +1 -1
index f58e41d..4bdf809 100644
@@ -400,7 +400,7 @@ asn1_oid_decode(struct asn1_ctx *ctx,
       size = eoc - ctx->pointer + 1;
 
       /* first subid actually encodes first two subids */
-       if (size < 2 || size > ULONG_MAX/sizeof(unsigned long))
+       if (size < 2 || size > UINT_MAX/sizeof(unsigned int))
               return 0;
 
       *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
Signature · 3 lines
Thanks,

Steve