From patchwork Wed Sep 29 12:52:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 66065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0BFBDB7116 for ; Wed, 29 Sep 2010 22:56:23 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P0wB6-0003Ap-W2; Wed, 29 Sep 2010 12:54:33 +0000 Received: from mail-bw0-f49.google.com ([209.85.214.49]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P0wB3-0003A8-EP for linux-mtd@lists.infradead.org; Wed, 29 Sep 2010 12:54:30 +0000 Received: by bwz19 with SMTP id 19so654907bwz.36 for ; Wed, 29 Sep 2010 05:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:reply-to:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=jpSjAjrYli1TdeSOGnVpOxpUVJRb8C985IMwyyFstJk=; b=E4P0eYgQeYUe4f4sVabo4yW9xHEWGTKo944PM0tqjJKkqXOUWhppnXnIJrx4b0JSPb /qh51elXlSQzf4yvOmTg1vfqSwWPhUx+QcNlM9O2AN4EF7Cmhp+qLg1GR3peafBIZDf7 yjn0k467WFVGm7Aem9cVRLS3sMAYhBgkJC/N0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:reply-to:to:cc:in-reply-to:references:content-type :date:message-id:mime-version:x-mailer:content-transfer-encoding; b=dPzkdbl4baPlIrbfcXhZ6f60DGzdPipGYjq575NJBVDSTHVfUXeG825k6R4yFR3YAv 1LQlrHXBnZhHuebfuPuM9Z6V6DdALi3DpUVyqJsSLCN6CYW6xs0XHnZ/Zr+sTVDhyXQB RIuvsB4CqMTvw1s4qMM4F6hAJ7BPPNw41cK+Q= Received: by 10.204.60.212 with SMTP id q20mr1259586bkh.26.1285764868045; Wed, 29 Sep 2010 05:54:28 -0700 (PDT) Received: from ?IPv6:::1? (shutemov.name [188.40.19.243]) by mx.google.com with ESMTPS id x13sm6609598bki.12.2010.09.29.05.54.26 (version=SSLv3 cipher=RC4-MD5); Wed, 29 Sep 2010 05:54:27 -0700 (PDT) Subject: Re: pwrite() to nand in raw mode fails with EINVAL From: Artem Bityutskiy To: mbizon@freebox.fr, Maxim Levitsky In-Reply-To: <1285699650.32420.70.camel@sakura.staff.proxad.net> References: <1285699650.32420.70.camel@sakura.staff.proxad.net> Date: Wed, 29 Sep 2010 15:52:27 +0300 Message-ID: <1285764747.2437.116.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 (2.30.3-1.fc13) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100929_085429_675009_C0B92DC4 X-CRM114-Status: GOOD ( 22.40 ) X-Spam-Score: 2.1 (++) X-Spam-Report: SpamAssassin version 3.3.1 on bombadil.infradead.org summary: Content analysis details: (2.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (dedekind1[at]gmail.com) 2.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: David Woodhouse , "linux-mtd@lists.infradead.org" X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Maxime, I've cleaned up comments, added your signed-off-by and cc stable. Is this OK? It would also be nice to get an ack from Maxim Levitsky. From: Maxime Bizon Subject: [PATCH] mtd: fix NAND pwrite in raw mode Since commit 782ce79a45b3b850b108896fcf7da26754061c8f ("cleanup the nand_do_write_ops") 'pwrite()' to a NAND device fails with '-EINVAL' which comes from: /* Don't allow multipage oob writes with offset */ if (ops->ooboffs && (ops->ooboffs + ops->ooblen > oobmaxlen)) return -EINVAL; because 'ops->ooboffs' was uninitialized. This patch fixes the issue. Artem: clean-up comment, add stable. Signed-off-by: Maxime Bizon Cc: stable Signed-off-by: Artem Bityutskiy Acked-by: Maxim Levitsky --- drivers/mtd/mtdchar.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index a825002..39dcb57 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -216,6 +216,7 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t { struct mtd_oob_ops ops; + memset(&ops, 0, sizeof (ops)); ops.mode = MTD_OOB_RAW; ops.datbuf = kbuf; ops.oobbuf = NULL; @@ -319,6 +320,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count { struct mtd_oob_ops ops; + memset(&ops, 0, sizeof (ops)); ops.mode = MTD_OOB_RAW; ops.datbuf = kbuf; ops.oobbuf = NULL;