Message ID | 20110106194059.GC1717@bicker (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-path: <mchehab@gaivota> Envelope-to: mchehab@gaivota Delivery-date: Thu, 06 Jan 2011 17:52:36 -0200 Received: from mchehab by gaivota with local (Exim 4.72) (envelope-from <mchehab@gaivota>) id 1Pavsx-0004dI-Tl for mchehab@gaivota; Thu, 06 Jan 2011 17:52:36 -0200 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.17) for <mchehab@localhost> (single-drop); Thu, 06 Jan 2011 17:52:35 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Pavk5-0002c9-Mj; Thu, 06 Jan 2011 19:43:26 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753467Ab1AFTnS (ORCPT <rfc822; kmpark@infradead.org> + 1 other); Thu, 6 Jan 2011 14:43:18 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:43311 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752824Ab1AFTnR (ORCPT <rfc822; linux-media@vger.kernel.org>); Thu, 6 Jan 2011 14:43:17 -0500 Received: by wwa36 with SMTP id 36so17760984wwa.1 for <multiple recipients>; Thu, 06 Jan 2011 11:43:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=fFst3HVrxHRZVtIJW5otKmTT2P82Q327OouiHm9kYbk=; b=bjkqEa0jcvPojkMeE7WOct867eL0OgaxPCTk3L9SLmXM3eOBMXBrcJ3ZsSijaVqbTy F+I4MgPzgCI4TlRTTLakrkJvyTpMZJbUY1A669KXyvvzBa0uJ51vOboJvHRjhQXC58Lf /WIuyWEztyGw6BAKHSRQNUzzMpQuuBklX9Yvs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=M+QDRXsN3yWn/u6/eRAaFC2v/o8iQq+r9xvVWRTy+0hx1KrHmpQWiSluAs9NF63Kta uttko9TmP0tWPYZTqrtdCfxZpkfW6IIm4nWsJ6Fw3BHD+/ShDbPKqUTLkV9VMxaYVxKO 6tEFqakXtaEgpo2IZS3eqxjy1YXKvL5WsAOaY= Received: by 10.216.30.3 with SMTP id j3mr379979wea.42.1294342875327; Thu, 06 Jan 2011 11:41:15 -0800 (PST) Received: from bicker ([41.202.225.146]) by mx.google.com with ESMTPS id c54sm6958509wer.30.2011.01.06.11.41.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 06 Jan 2011 11:41:14 -0800 (PST) Date: Thu, 6 Jan 2011 22:41:00 +0300 From: Dan Carpenter <error27@gmail.com> To: Mauro Carvalho Chehab <mchehab@infradead.org> Cc: linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] [media] av7110: make array offset unsigned Message-ID: <20110106194059.GC1717@bicker> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org Sender: Mauro Carvalho Chehab <mchehab@gaivota> |
Commit Message
Dan Carpenter
Jan. 6, 2011, 7:41 p.m. UTC
In the CA_GET_SLOT_INFO ioctl, we only check whether "num" is too large,
but we don't check if it's negative.
drivers/media/dvb/ttpci/av7110_ca.c
278 ca_slot_info_t *info=(ca_slot_info_t *)parg;
279
280 if (info->num > 1)
281 return -EINVAL;
282 av7110->ci_slot[info->num].num = info->num;
Let's just make it unsigned.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Compile tested.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Comments
On 01/06/2011 08:41 PM, Dan Carpenter wrote: > In the CA_GET_SLOT_INFO ioctl, we only check whether "num" is too large, > but we don't check if it's negative. > > drivers/media/dvb/ttpci/av7110_ca.c > 278 ca_slot_info_t *info=(ca_slot_info_t *)parg; > 279 > 280 if (info->num > 1) > 281 return -EINVAL; > 282 av7110->ci_slot[info->num].num = info->num; > > Let's just make it unsigned. > > Signed-off-by: Dan Carpenter <error27@gmail.com> Nack. You're changing an interface to userspace. Please add a check to av7110_ca.c instead. Regards, Andreas -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Jan 07, 2011 at 01:44:15PM +0100, Andreas Oberritter wrote: > Nack. You're changing an interface to userspace. Please add a check to > av7110_ca.c instead. > Ok. I've done that and resent the patch. But just for my own understanding, why is it wrong to change an int to an unsigned int in the userspace API? Who would notice? (I'm still quite a newbie at system programming). regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Jan 07, 2011 at 16:51 +0300, Dan Carpenter wrote: > But just for my own understanding, why is it wrong to change an int to > an unsigned int in the userspace API? Who would notice? E.g. the same check in userspace (var < 0). If var has changed the sign then the result would differ.
On 01/07/2011 02:51 PM, Dan Carpenter wrote: > On Fri, Jan 07, 2011 at 01:44:15PM +0100, Andreas Oberritter wrote: >> Nack. You're changing an interface to userspace. Please add a check to >> av7110_ca.c instead. >> > > Ok. I've done that and resent the patch. Thanks. I'm OK with the patch, but I'll leave it to the maintainer of av7110 to decide whether he likes the cast or prefers an additional signed compare. I added him to CC. > But just for my own understanding, why is it wrong to change an int to > an unsigned int in the userspace API? Who would notice? (I'm still > quite a newbie at system programming). It would generate compiler warnings in userspace for programs checking for values < 0 or assigning negative values (for whatever reason). Regards, Andreas -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/dvb/ca.h b/include/linux/dvb/ca.h index c18537f..647015e 100644 --- a/include/linux/dvb/ca.h +++ b/include/linux/dvb/ca.h @@ -27,7 +27,7 @@ /* slot interface types and info */ typedef struct ca_slot_info { - int num; /* slot number */ + unsigned int num; /* slot number */ int type; /* CA interface this slot supports */ #define CA_CI 1 /* CI high level interface */