Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp446275imm; Fri, 5 Oct 2018 06:27:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV60yVRuH68mFjxih1d/cqcZL5fBleYdn6Vzd/MuMyamixQxW27jyUjxWPcUSpnQkwGpQP4rD X-Received: by 2002:a63:cf0e:: with SMTP id j14-v6mr10184917pgg.195.1538746054401; Fri, 05 Oct 2018 06:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538746054; cv=none; d=google.com; s=arc-20160816; b=IoGS0cGq7Ss7gmBYwle5s8AXQMUPastyA1FuvFLDefYqa06Mv1MzbPrnhxWKHvYsGl u4pmiwWUBinABcWQqK43+qowtoZCh0XsqT83RoJjkm/g9QMDZ36xLx97zq9NrZV851Rt 79mZcZFNrrUr8eh1mbOCv7KtpCzUqZNrR1btDM5cj2ddnAaI66cq5zV4N9L4xmtJ7dC1 lRD2fFCt2fBcsr4eXK/pNCivstLv79UjvOl1ngUWXI4yjI0RkTAT0Ambd1SuTUPwPjkR R+ORwbNzhzcRBVQ69GzQ0IBEEdMHn9OsYxhfmqQvqmj5nvTdU2FsrDTausE0JyhR84LH HLfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=UqUL9SkpdJz9RMWiehPVKTpihQd+cH0u1dIADWyIUYc=; b=bBKEmU3CScj2VicesNHyhzCgPh7m8b4xJlW3wn0gY6DYVaxMGfsVdU+M5tqndEtoVU K150BsTcAy86BVbq26zmEYtBN76AUYHYIQtVCptpkWEWnK57LyFz8cdCzMUOmzoPXCAU Een2s2nB4l396Bt3RPv/6BW1e3Z4wTrwxfCrlhwKxHERxEbnvY4Hyv/cbNlvv7sT3OKy LhKRD04AZ4EZQkPlT+4Ehyv2eYLZVVBQ4wgaasH6J2DQESN1Pik3UR6mBhT5xtV9g5eA +7wHcIksZ2cLgn7o2slmMR52v63A8Owl7lsJnKpnAMh9QxEKDcYAey14bvz1loo3wPX/ lSaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uIPECjwy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q27-v6si8897726pfd.285.2018.10.05.06.27.18; Fri, 05 Oct 2018 06:27:34 -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=fail header.i=@gmail.com header.s=20161025 header.b=uIPECjwy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728921AbeJEUZJ (ORCPT + 99 others); Fri, 5 Oct 2018 16:25:09 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40055 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727701AbeJEUZJ (ORCPT ); Fri, 5 Oct 2018 16:25:09 -0400 Received: by mail-pf1-f196.google.com with SMTP id s5-v6so5086442pfj.7; Fri, 05 Oct 2018 06:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UqUL9SkpdJz9RMWiehPVKTpihQd+cH0u1dIADWyIUYc=; b=uIPECjwyICsYfVHlBsBAmw3FzqEaxWMs3feoxEhwlDDOIFCSEZIUPg4wQY96HcRxur tVzxAwiinxN/L/N9inR/RwUZBup1Vb4/TLq5eX2tDYJzl+RKrTRoO+5HcwFwpc9sloFf y3y6vC/kVeZ0ZQUJW5Dv3HME5x9cHb7UFuYkkHex8AbFa+iQyI7h304OIzCpNNflHwvL 2FMzgQ0iQJkFReTscHJX6rOCRoJKrd8zhpqJA99hMZiR8OOK51ZmBZMTfs9q8ojjRqeP DL9qYIs+vJmvOL8qYILQ8VGcMYACXtwoif28/JpSs4Xh7vK//XRdXuLEa2N+xh4giUCd rNgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UqUL9SkpdJz9RMWiehPVKTpihQd+cH0u1dIADWyIUYc=; b=QbWD9A8RPsizT6LW5l/Am2RWZ9HWsv0M9ru84Bx5HpKYBPr7V/B67eMwWG1Tiz7LFr adNmteSgNXasWFWvIDXfBYrVPe6NdsYjUYXPODaHU1C0UzQRuTkMRHwBLk6xTRt/bnJv a5mZbYfnyDDB0kGPifGGJzWZmKP0zg7pfjMotWjJk2f8etfu7UetzoJOQKYWhM1zwBBV O2lA701H5/HtxzAVtOihzRBVCFl2FbSnZRvtIt7I7KPvMF+MQ8ooboCdK/QZtt10gtrA 5u182KMfwKzrZqNm/2j/KQaPWtGQeynghwwyPflNR7YXyRSucBFAO9RJxko5ebvaPDQL yPeg== X-Gm-Message-State: ABuFfojlX6Pnh7j3wAWFj8bJLeHOGxfev/pGFFMaR8ocAw4Um2rh2MhP WJNOnViXFnAKKo+M9ApLa1vnryMa X-Received: by 2002:a63:1148:: with SMTP id 8-v6mr10397630pgr.172.1538745985550; Fri, 05 Oct 2018 06:26:25 -0700 (PDT) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id n80-v6sm14580331pfh.166.2018.10.05.06.26.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 06:26:24 -0700 (PDT) Subject: Re: [PATCH 15/16] of: unittest: initialize args before calling of_irq_parse_one() To: frowand.list@gmail.com, Rob Herring , Pantelis Antoniou , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alan Tull , Moritz Fischer Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org References: <1538712767-30394-1-git-send-email-frowand.list@gmail.com> <1538712767-30394-16-git-send-email-frowand.list@gmail.com> From: Guenter Roeck Message-ID: <7fc4b9da-5fdf-11c9-e168-ccb2d960adea@roeck-us.net> Date: Fri, 5 Oct 2018 06:26:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1538712767-30394-16-git-send-email-frowand.list@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/04/2018 09:12 PM, frowand.list@gmail.com wrote: > 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 Reviewed-by: Guenter Roeck The same problem exists when of_parse_phandle_with_args() reports an error. Guenter > --- > 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 */ >