From patchwork Fri Nov 26 17:06:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasiliy Kulikov X-Patchwork-Id: 359332 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAQH80D3031361 for ; Fri, 26 Nov 2010 17:08:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755535Ab0KZRGp (ORCPT ); Fri, 26 Nov 2010 12:06:45 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:42343 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755526Ab0KZRGn (ORCPT ); Fri, 26 Nov 2010 12:06:43 -0500 Received: by mail-ew0-f46.google.com with SMTP id 5so1069559ewy.19 for ; Fri, 26 Nov 2010 09:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:cc:subject :date:message-id:x-mailer; bh=iBkJDlKyCb4UYaccqseCUYIFVakCfdS3N8TS0zCbyPY=; b=nKD+KqzH+GfjkKuGGp+4Bmm7gM3xd7hebKITMuClHuWdrQ7QY5tylkaJ6Fn1myYnmr LjDSNapyghGVDX/2eu0fp+raGgY+iEq7CxlXl38dYuiOF8akECE5doWE53ezPPTjxd+v t2cOSrcZkYboWIfGHJKZ38k/BeWsk6scTN/fg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; b=OunNQfm9oFmeV7C8O5zFJLKLY6DY5baVINIYoelzDoBtCzpcs6KqoFBdl2T+MZCgtC xX7TDQR1ZdBw+WDsTej+A3cFAmomXQsfAnJzC9dKFfHBbJUiLvMZ/5r0UGgXMvstSobq fHSqA5n11dJOdrZ79d+Egn4V3LRZTyT+iGWcI= Received: by 10.14.47.78 with SMTP id s54mr2123545eeb.20.1290791201964; Fri, 26 Nov 2010 09:06:41 -0800 (PST) Received: from localhost (ppp91-78-210-29.pppoe.mtu-net.ru [91.78.210.29]) by mx.google.com with ESMTPS id q58sm1914122eeh.9.2010.11.26.09.06.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 26 Nov 2010 09:06:41 -0800 (PST) From: Vasiliy Kulikov To: kernel-janitors@vger.kernel.org Cc: Mauro Carvalho Chehab , =?UTF-8?q?David=20H=C3=A4rdeman?= , Jarod Wilson , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: rc: ir-lirc-codec: fix potential integer overflow Date: Fri, 26 Nov 2010 20:06:35 +0300 Message-Id: <1290791197-21403-1-git-send-email-segoon@openwall.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 26 Nov 2010 17:08:01 +0000 (UTC) diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 1e87ee8..f011c5d 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -100,7 +100,8 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, struct lirc_codec *lirc; struct rc_dev *dev; int *txbuf; /* buffer with values to transmit */ - int ret = 0, count; + int ret = 0; + size_t count; lirc = lirc_get_pdata(file); if (!lirc) @@ -110,7 +111,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, return -EINVAL; count = n / sizeof(int); - if (count > LIRCBUF_SIZE || count % 2 == 0) + if (count > LIRCBUF_SIZE || count % 2 == 0 || n % sizeof(int) != 0) return -EINVAL; txbuf = memdup_user(buf, n);