public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Adam Ford <aford173@gmail.com>,
	linux-clk@vger.kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org, dan.carpenter@oracle.com,
	aford@beaconembedded.com, Adam Ford <aford173@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: vc5: Add memory check to prevent oops
Date: Thu, 2 Jul 2020 17:42:50 +0300	[thread overview]
Message-ID: <20200702144250.GQ2549@kadam> (raw)
In-Reply-To: <20200630210155.459250-1-aford173@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3796 bytes --]

Hi Adam,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Adam-Ford/clk-vc5-Add-memory-check-to-prevent-oops/20200701-050451
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: i386-randconfig-m021-20200701 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/clk/clk-versaclock5.c:818 vc5_get_output_config() error: uninitialized symbol 'np_output'.

# https://github.com/0day-ci/linux/commit/d445df5e4f918f08f66e20c366dc6c81dcdc8b57
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d445df5e4f918f08f66e20c366dc6c81dcdc8b57
vim +/np_output +818 drivers/clk/clk-versaclock5.c

260249f929e81d Adam Ford 2020-06-03  783  
260249f929e81d Adam Ford 2020-06-03  784  static int vc5_get_output_config(struct i2c_client *client,
260249f929e81d Adam Ford 2020-06-03  785  				 struct vc5_hw_data *clk_out)
260249f929e81d Adam Ford 2020-06-03  786  {
260249f929e81d Adam Ford 2020-06-03  787  	struct device_node *np_output;
                                                                    ^^^^^^^^^

260249f929e81d Adam Ford 2020-06-03  788  	char *child_name;
260249f929e81d Adam Ford 2020-06-03  789  	int ret = 0;
260249f929e81d Adam Ford 2020-06-03  790  
260249f929e81d Adam Ford 2020-06-03  791  	child_name = kasprintf(GFP_KERNEL, "OUT%d", clk_out->num + 1);
d445df5e4f918f Adam Ford 2020-06-30  792  	if (!child_name) {
d445df5e4f918f Adam Ford 2020-06-30  793  		ret = -ENOMEM;
d445df5e4f918f Adam Ford 2020-06-30  794  		goto output_error;
                                                        ^^^^^^^^^^^^^^^^^^
Better to just return directly, because there is no clean up.

d445df5e4f918f Adam Ford 2020-06-30  795  	}
260249f929e81d Adam Ford 2020-06-03  796  	np_output = of_get_child_by_name(client->dev.of_node, child_name);
260249f929e81d Adam Ford 2020-06-03  797  	kfree(child_name);
260249f929e81d Adam Ford 2020-06-03  798  	if (!np_output)
d445df5e4f918f Adam Ford 2020-06-30  799  		return 0;
260249f929e81d Adam Ford 2020-06-03  800  
260249f929e81d Adam Ford 2020-06-03  801  	ret = vc5_update_mode(np_output, clk_out);
260249f929e81d Adam Ford 2020-06-03  802  	if (ret)
260249f929e81d Adam Ford 2020-06-03  803  		goto output_error;
260249f929e81d Adam Ford 2020-06-03  804  
260249f929e81d Adam Ford 2020-06-03  805  	ret = vc5_update_power(np_output, clk_out);
260249f929e81d Adam Ford 2020-06-03  806  	if (ret)
260249f929e81d Adam Ford 2020-06-03  807  		goto output_error;
260249f929e81d Adam Ford 2020-06-03  808  
260249f929e81d Adam Ford 2020-06-03  809  	ret = vc5_update_slew(np_output, clk_out);
260249f929e81d Adam Ford 2020-06-03  810  
260249f929e81d Adam Ford 2020-06-03  811  output_error:
260249f929e81d Adam Ford 2020-06-03  812  	if (ret) {
260249f929e81d Adam Ford 2020-06-03  813  		dev_err(&client->dev,
260249f929e81d Adam Ford 2020-06-03  814  			"Invalid clock output configuration OUT%d\n",
260249f929e81d Adam Ford 2020-06-03  815  			clk_out->num + 1);
260249f929e81d Adam Ford 2020-06-03  816  	}
260249f929e81d Adam Ford 2020-06-03  817  
260249f929e81d Adam Ford 2020-06-03 @818  	of_node_put(np_output);
                                                            ^^^^^^^^^
Uninitialized.

260249f929e81d Adam Ford 2020-06-03  819  
260249f929e81d Adam Ford 2020-06-03  820  	return ret;
260249f929e81d Adam Ford 2020-06-03  821  }
260249f929e81d Adam Ford 2020-06-03  822  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41839 bytes --]

      reply	other threads:[~2020-07-02 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 21:01 [PATCH] clk: vc5: Add memory check to prevent oops Adam Ford
2020-07-02 14:42 ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200702144250.GQ2549@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=aford173@gmail.com \
    --cc=aford@beaconembedded.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=marek.vasut@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox