From patchwork Thu Nov 12 00:47:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 543159 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-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 854BE1402BF for ; Thu, 12 Nov 2015 11:50:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=XDcWDiXW; 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 1Zwg3w-0005Sf-Oh; Thu, 12 Nov 2015 00:48:28 +0000 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zwg3u-0005Rp-H9 for linux-mtd@lists.infradead.org; Thu, 12 Nov 2015 00:48:27 +0000 Received: by pasz6 with SMTP id z6so47895781pas.2 for ; Wed, 11 Nov 2015 16:48:05 -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; bh=LFHu4Mo1Z7ewRuplJGxXPn1tamLjQjaXtavvmN922I4=; b=XDcWDiXWXMDFDzoMs9iFbwfO2IjBcczPdfNRkdRK5JWmldkhSUEk/TrSj1p4JfZE84 fUODqI04l69E275SlHb8Nw8hOl9TxQz+oqnyExbUt3TeqOy7Jsop5I3M4Ghh4fnGSbnO LPN063oUxOLONv8wat8Z07FjslAZ87g0OFCd1b8YRvFvlBBWwHsexOZDuqiwfx7QqHom 8nIVhVdTzdLhy2rEyLgdRVs1uJ+hWfx1iffMHtq+9U5WRfNk9YUO+gWkDZnHdbSwL8sp B1/Ex63SAaFby8dXwtd5yU5NlqK5IDU/q/tj3I3R1+87xCNUGcRjjDfgl961Lj8anznD FYNw== X-Received: by 10.66.159.38 with SMTP id wz6mr6434529pab.12.1447289285573; Wed, 11 Nov 2015 16:48:05 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id ju7sm11443351pbc.83.2015.11.11.16.48.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Nov 2015 16:48:04 -0800 (PST) From: Brian Norris To: Subject: [PATCH] mtd: zero out mtd_partion struct before using it Date: Wed, 11 Nov 2015 16:47:52 -0800 Message-Id: <1447289272-131828-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151111_164826_608598_F1EDA2DC X-CRM114-Status: UNSURE ( 8.32 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c03:0:0:0:234 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Brian Norris MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It's easier to guarantee we've cleared out all unused fields with memset() than by manually initializing each field. Signed-off-by: Brian Norris Reviewed-by: Boris Brezillon --- I hit this while testing out the added 'of_node' field: http://patchwork.ozlabs.org/patch/538838/ drivers/mtd/mtdpart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index c2b6e967a160..3ace53342fd2 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -597,11 +597,10 @@ int mtd_add_partition(struct mtd_info *master, const char *name, if (length <= 0) return -EINVAL; + memset(&part, 0, sizeof(part)); part.name = name; part.size = length; part.offset = offset; - part.mask_flags = 0; - part.ecclayout = NULL; new = allocate_partition(master, &part, -1, offset); if (IS_ERR(new))