Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp189061imm; Thu, 4 Oct 2018 21:16:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV63pYuS0oim9KEDIfqAyyjIpn9YNBj+Bepz3/TgGdWrFZHQ4uBu6DKaEE0qhp6+61L2u7Dhq X-Received: by 2002:a17:902:34a:: with SMTP id 68-v6mr9576113pld.39.1538712970676; Thu, 04 Oct 2018 21:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538712970; cv=none; d=google.com; s=arc-20160816; b=MpjMJCQJ+UHrHi6Vtl+WRZNV/TBiHIh8gZLjArmdblVHjq7E+PLcD/1wt9PdajMvt3 KmFAPd46ZrnqiBZyR8Zxb1PxYdE0EOYo2Urf/Md2DRkHgtWgimPY8ro1Py6mUdE/21uc U/v8MF8bCijlvAGY6v1WA7fbTYVTLqxs9Nx80SsP5S1DiIOtSjMRjzv2rp993cbEeYL1 981t1U6jzYcITyiDYFr8O21pfJWdey6QP8RFn/0lDQ3zmEceg80B7gY4kMuuV9ILmNG2 nZ4VRAJBixQMlb6gEkjyClsS01jV8YDqkwWtLWapq9LLQOst9gl8qEQxGDeF61UqWobZ Q9zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=6rXTsHTXEu0ePfav46SJfn/0WRudrcKzA2MYy/8i5Ig=; b=qr98mh3WnrwghPLoO5v7U3d4ki18kCW26YM0m0t63blBDsoLSYjMPJ+WraO/WFVg8p m7J6eIjYYQ7AU6F+Shm3X395oaEo+nSIAXoaMm/0do+aJzczBcDyAnwNhgtgq/NvAhD1 zWrvSsUPXGHNOaggAP2NTNUV9B6iNy3dPcqtHaFwCMKAEJREal/IhtflQdbXXoHvR6J0 VyTZHbXvbjPg83B4BOzL7Ae5NosjwiuS+INs7BaA7XgUDDNPSdsdCZ9h2JI3XHnUDhIV ECPwYyn1Nl0UOjTcsLiw1xU9bvF+TcWNr5syAGbqs/q4zFBv12Zk+Y9Q4WiXkslMOegx eBzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M8OeIxic; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3-v6si7579164plk.114.2018.10.04.21.15.55; Thu, 04 Oct 2018 21:16:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M8OeIxic; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbeJELLY (ORCPT + 99 others); Fri, 5 Oct 2018 07:11:24 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43723 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727799AbeJELLW (ORCPT ); Fri, 5 Oct 2018 07:11:22 -0400 Received: by mail-pg1-f196.google.com with SMTP id 80-v6so4121333pgh.10; Thu, 04 Oct 2018 21:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6rXTsHTXEu0ePfav46SJfn/0WRudrcKzA2MYy/8i5Ig=; b=M8OeIxicV23kcfKfRr40LQOmdI4hpD/+kDesn8YVAAjltVpo1dI3FqLGaJVHSc4uWP nLLrT4Yxi4gx5TPfxzY+4jEjp3pUaLZgD+5YX7BlbFYNwgLgyVjBVIpRkjv7qdJsBTan T2gLvI3hIj5EuP8VNsEIu4q4Atzy0mObD9NjJatbIDFI0dE8bTR1wtmVkfoF2+fSVPy4 DWdA/3dmk+36dDH7kOkO+Z9/FcTo5ResY+lbPkfYrZnZ6Mur1c7ed/DHW03gjIvaR4w/ dcYwN+3vTawpW4lC8VcH53+mmW53+S3MePTv6hMnhAmwJo1NJxVLozLDYKl7hQ5qhjbF hEWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6rXTsHTXEu0ePfav46SJfn/0WRudrcKzA2MYy/8i5Ig=; b=URb7gfwz12t3FmVr1hCA5/VhhPsWYy/tibwT6rVwBkqQzK6cUd/CHNBgJN3cgaCpUQ Ovgutm1mOwcYvgmi+RyFYkZwkzvufzNdIanB3KUWGbfeW1NOYVrDyKrf3S7IN1Vzmlhu LYRqc40nLG+bdk96JGuhTgAkK0FvlDGsE+6RY/btTFssCEUC6pmaqCqr7azzxc6tSD7R HpyswRoWfAKYtLlu50WY5cXT2YA4o8nJQfUX+kS7oC79FjENmCeo9C3DSwo02HzPJb8z AJOq/GikeHfwazx7bAxbPgMqKMl39RHfjtOqrgEHBICiMGshJc/bVIC18FYiNB69PnkO 9+UQ== X-Gm-Message-State: ABuFfojG6s6KZQ+i2m1o9hOkcCvU+z25AjxtohgM6lCEENAeu0Au6pRH a5FnSg15jdaDrHGpNsQEbG4= X-Received: by 2002:a63:7506:: with SMTP id q6-v6mr8396282pgc.137.1538712870907; Thu, 04 Oct 2018 21:14:30 -0700 (PDT) Received: from localhost.localdomain (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id n63-v6sm277975pfn.9.2018.10.04.21.14.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Oct 2018 21:14:30 -0700 (PDT) From: frowand.list@gmail.com To: Rob Herring , Pantelis Antoniou , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alan Tull , Moritz Fischer , Guenter Roeck Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org Subject: [PATCH 15/16] of: unittest: initialize args before calling of_irq_parse_one() Date: Thu, 4 Oct 2018 21:12:46 -0700 Message-Id: <1538712767-30394-16-git-send-email-frowand.list@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538712767-30394-1-git-send-email-frowand.list@gmail.com> References: <1538712767-30394-1-git-send-email-frowand.list@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frank Rowand Callers of of_irq_parse_one() blindly use the pointer args.np without checking whether of_irq_parse_one() had an error and thus did not set the value of args.np. Initialize args to zero so that using the format "%pOF" to show the value of args.np will show "(null)" when of_irq_parse_one() has an error and does not set args.np instead of trying to dereference a random value. Reported-by: Guenter Roeck Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 6d80f474c8f2..b61a33f30a56 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -780,7 +780,7 @@ static void __init of_unittest_parse_interrupts(void) for (i = 0; i < 4; i++) { bool passed = true; - args.args_count = 0; + memset(&args, 0, sizeof(args)); rc = of_irq_parse_one(np, i, &args); passed &= !rc; @@ -801,7 +801,7 @@ static void __init of_unittest_parse_interrupts(void) for (i = 0; i < 4; i++) { bool passed = true; - args.args_count = 0; + memset(&args, 0, sizeof(args)); rc = of_irq_parse_one(np, i, &args); /* Test the values from tests-phandle.dtsi */ @@ -854,6 +854,7 @@ static void __init of_unittest_parse_interrupts_extended(void) for (i = 0; i < 7; i++) { bool passed = true; + memset(&args, 0, sizeof(args)); rc = of_irq_parse_one(np, i, &args); /* Test the values from tests-phandle.dtsi */ -- Frank Rowand