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

Arnaldo Carvalho de Melo
2003-11-11T02:24:55Z

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;