[PATCH] irda: fix type of struct irda_ias_set.attribute.irda_attrib_string.len

From: Arnaldo Carvalho de Melo
Date: Mon Nov 10 2003 - 21:26:04 EST


CC [M] net/irda/af_irda.o
net/irda/af_irda.c: In function `irda_setsockopt':
net/irda/af_irda.c:1894: warning: comparison is always false due to limited range of data type

in irda_setsockopt:

/* Should check charset & co */
/* Check length */
if(ias_opt->attribute.irda_attrib_string.len >
IAS_MAX_STRING) {
kfree(ias_opt);
return -EINVAL;
}

Ok, ias_opt->attribute.irda_attrib_string.len is __u8, but
IAS_MAX_STRING = 256... so attribute.irda_attrib_string.len has to be at least
__u18, this patch fix this, please see if it is appropriate and if it is so,
apply.

Best Regards,

- Arnaldo

===== include/linux/irda.h 1.7 vs edited =====
--- 1.7/include/linux/irda.h Wed Jun 4 11:16:33 2003
+++ edited/include/linux/irda.h Mon Nov 10 23:56:33 2003
@@ -151,7 +151,7 @@
__u8 octet_seq[IAS_MAX_OCTET_STRING];
} irda_attrib_octet_seq;
struct {
- __u8 len;
+ __u16 len;
__u8 charset;
__u8 string[IAS_MAX_STRING];
} irda_attrib_string;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/