From patchwork Sat Feb 28 10:23:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 444612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41637140111 for ; Sat, 28 Feb 2015 21:30:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=UVO64VlQ; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YReeK-0008Ar-E5; Sat, 28 Feb 2015 10:29:32 +0000 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YRedv-0007qf-Aj for linux-mtd@lists.infradead.org; Sat, 28 Feb 2015 10:29:09 +0000 Received: by pdbnh10 with SMTP id nh10so3478065pdb.3 for ; Sat, 28 Feb 2015 02:28:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dFgG0KxNwI0g/VoaJ6Ye9jn1rkr9uDFDFx90GCm+HA8=; b=UVO64VlQg7qXMiiIWujGjiq2BZwXcbdtPaBphGOcbu9b4NaAZguNq93H6oZbJiqA/N 20pAmywVP504OTfWS0mmTZ/H9n/NikFWdrDjd4EbjrCVIGfs+lletigrkqKz3oQmeXqQ MAay9yjSxeKuXPcEDjz4xT0M9+xzzHJIMyLxmGgkdLY+1xUBRirM9kyyDvS4ERNUoi6V QguoHa/cbJsttwc/XF5YG3KN/VISbr7gQyu0iw3+/rkOaWUCsPRu4zgvgqV2JmzSDs48 iRmLmTmpmYQLi0iXuzqepS2Uwy4wrUGYrxz9dIpa5X+UZn3CghTIJHjJJ9D15n1Ksa3+ zPTQ== X-Received: by 10.68.65.42 with SMTP id u10mr30738388pbs.81.1425119326562; Sat, 28 Feb 2015 02:28:46 -0800 (PST) Received: from localhost.localdomain (cpe-45-48-59-37.socal.res.rr.com. [45.48.59.37]) by mx.google.com with ESMTPSA id d4sm454934pdm.50.2015.02.28.02.28.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Feb 2015 02:28:45 -0800 (PST) From: Brian Norris To: Richard Weinberger , Artem Bityutskiy Subject: [PATCH 4/5] UBI: fix check for "too many bytes" Date: Sat, 28 Feb 2015 02:23:28 -0800 Message-Id: <1425119009-28634-5-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1425119009-28634-1-git-send-email-computersforpeace@gmail.com> References: <1425119009-28634-1-git-send-email-computersforpeace@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150228_022907_428809_2A0A88C4 X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c02:0:0:0:22f listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Cc: kernel-janitors@vger.kernel.org, Brian Norris , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The comparison from the previous line seems to have been erroneously (partially) copied-and-pasted onto the next. The second line should be checking req.bytes, not req.lnum. Coverity CID #139400 Signed-off-by: Brian Norris --- drivers/mtd/ubi/cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index d647e504f9b1..7691a2a015cb 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -455,7 +455,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, /* Validate the request */ err = -EINVAL; if (req.lnum < 0 || req.lnum >= vol->reserved_pebs || - req.bytes < 0 || req.lnum >= vol->usable_leb_size) + req.bytes < 0 || req.bytes >= vol->usable_leb_size) break; err = get_exclusive(desc);