From f4e376709546ba654c8e090ecae8700b6a99c041 Mon Sep 17 00:00:00 2001 From: Jean Tourrilhes Date: Thu, 8 Jan 2004 10:11:04 -0800 Subject: [PATCH] [IRDA]: Fix compiler warning in af_irda.c --- net/irda/af_irda.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index c5dee17a2629e..86bc800c26e0e 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -1891,11 +1891,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname, case IAS_STRING: /* Should check charset & co */ /* Check length */ - if(ias_opt->attribute.irda_attrib_string.len > - IAS_MAX_STRING) { - kfree(ias_opt); - return -EINVAL; - } + /* The length is encoded in a __u8, and + * IAS_MAX_STRING == 256, so there is no way + * userspace can pass us a string too large. + * Jean II */ /* NULL terminate the string (avoid troubles) */ ias_opt->attribute.irda_attrib_string.string[ias_opt->attribute.irda_attrib_string.len] = '\0'; /* Add a string attribute */ -- 2.53.0