Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1530808 > unrolled thread

drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.

Started bykbuild test robot <fengguang.wu@intel.com>
First post2016-11-27 00:20 +0100
Last post2016-11-28 10:10 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but  dereferenced. kbuild test robot <fengguang.wu@intel.com> - 2016-11-27 00:20 +0100
    Re: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL  but dereferenced. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-27 12:10 +0100
      Re: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL  but dereferenced. Fengguang Wu <fengguang.wu@intel.com> - 2016-11-28 09:30 +0100
        Re: [kbuild-all] drivers/staging/greybus/bootrom.c:298:35-39: ERROR:  fw is NULL but dereferenced. Fengguang Wu <fengguang.wu@intel.com> - 2016-11-28 10:10 +0100
        Re: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL  but dereferenced. Julia Lawall <julia.lawall@lip6.fr> - 2016-11-28 10:10 +0100

#1530808 — drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.

Fromkbuild test robot <fengguang.wu@intel.com>
Date2016-11-27 00:20 +0100
Subjectdrivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.
Message-ID<sHUqe-4EY-29@gated-at.bofh.it>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a0d60e62ea5c88a9823410e9d0929a513e29dea2
commit: f44dd184634d401f5cf88a6d8b4a60d5ff4f417f Merge greybus driver tree into 4.8-rc6
date:   10 weeks ago


coccinelle warnings: (new ones prefixed by >>)

>> drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.

vim +298 drivers/staging/greybus/bootrom.c

90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  282  		dev_err(dev, "%s: error allocating response\n", __func__);
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  283  		ret = -ENOMEM;
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  284  		goto unlock;
90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  285  	}
90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  286  
90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  287  	firmware_response = op->response->payload;
98645a9c drivers/staging/greybus/firmware.c Johan Hovold 2015-11-19  288  	memcpy(firmware_response->data, fw->data + offset, size);
90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  289  
fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  290  	dev_dbg(dev, "responding with firmware (offs = %u, size = %u)\n", offset,
fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  291  		size);
fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  292  
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  293  unlock:
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  294  	mutex_unlock(&bootrom->mutex);
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  295  
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  296  queue_work:
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  297  	/* Refresh timeout */
a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22 @298  	if (!ret && (offset + size == fw->size))
a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  299  		next_request = NEXT_REQ_READY_TO_BOOT;
a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  300  	else
a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  301  		next_request = NEXT_REQ_GET_FIRMWARE;
a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  302  
dbb8cfeb drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  303  	gb_bootrom_set_timeout(bootrom, next_request, NEXT_REQ_TIMEOUT_MS);
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  304  
a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  305  	return ret;
90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  306  }

:::::: The code at line 298 was first introduced by commit
:::::: a4293e1d4e6416477976ee3bd248589d3fc4bb19 greybus: bootrom: Enhance timeout error message

:::::: TO: Viresh Kumar <viresh.kumar@linaro.org>
:::::: CC: Greg Kroah-Hartman <gregkh@google.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [next] | [standalone]


#1530857 — Re: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-11-27 12:10 +0100
SubjectRe: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.
Message-ID<sI5vk-3xy-17@gated-at.bofh.it>
In reply to#1530808
On Sun, Nov 27, 2016 at 07:11:46AM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   a0d60e62ea5c88a9823410e9d0929a513e29dea2
> commit: f44dd184634d401f5cf88a6d8b4a60d5ff4f417f Merge greybus driver tree into 4.8-rc6
> date:   10 weeks ago

This is a false-positive, sorry.

greg k-h

> 
> 
> coccinelle warnings: (new ones prefixed by >>)
> 
> >> drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.
> 
> vim +298 drivers/staging/greybus/bootrom.c
> 
> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  282  		dev_err(dev, "%s: error allocating response\n", __func__);
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  283  		ret = -ENOMEM;
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  284  		goto unlock;
> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  285  	}
> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  286  
> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  287  	firmware_response = op->response->payload;
> 98645a9c drivers/staging/greybus/firmware.c Johan Hovold 2015-11-19  288  	memcpy(firmware_response->data, fw->data + offset, size);
> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  289  
> fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  290  	dev_dbg(dev, "responding with firmware (offs = %u, size = %u)\n", offset,
> fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  291  		size);
> fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  292  
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  293  unlock:
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  294  	mutex_unlock(&bootrom->mutex);
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  295  
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  296  queue_work:
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  297  	/* Refresh timeout */
> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22 @298  	if (!ret && (offset + size == fw->size))
> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  299  		next_request = NEXT_REQ_READY_TO_BOOT;
> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  300  	else
> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  301  		next_request = NEXT_REQ_GET_FIRMWARE;
> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  302  
> dbb8cfeb drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  303  	gb_bootrom_set_timeout(bootrom, next_request, NEXT_REQ_TIMEOUT_MS);
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  304  
> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  305  	return ret;
> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  306  }
> 
> :::::: The code at line 298 was first introduced by commit
> :::::: a4293e1d4e6416477976ee3bd248589d3fc4bb19 greybus: bootrom: Enhance timeout error message
> 
> :::::: TO: Viresh Kumar <viresh.kumar@linaro.org>
> :::::: CC: Greg Kroah-Hartman <gregkh@google.com>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1531108 — Re: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.

FromFengguang Wu <fengguang.wu@intel.com>
Date2016-11-28 09:30 +0100
SubjectRe: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.
Message-ID<sIpu1-883-11@gated-at.bofh.it>
In reply to#1530857
On Sun, Nov 27, 2016 at 12:06:33PM +0100, Greg KH wrote:
>On Sun, Nov 27, 2016 at 07:11:46AM +0800, kbuild test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   a0d60e62ea5c88a9823410e9d0929a513e29dea2
>> commit: f44dd184634d401f5cf88a6d8b4a60d5ff4f417f Merge greybus driver tree into 4.8-rc6
>> date:   10 weeks ago
>
>This is a false-positive, sorry.

Yes it's a false warning: ret != 0, so fw->size in the if test won't be dereferenced.
Relevant code:

 if (!fw) {
                dev_err(dev, "%s: firmware not available\n", __func__);
                ret = -EINVAL;
                goto unlock;
        }
...
unlock:
        mutex_unlock(&bootrom->mutex);

queue_work:
        /* Refresh timeout */
        if (!ret && (offset + size == fw->size))
                next_request = NEXT_REQ_READY_TO_BOOT;
        else
                next_request = NEXT_REQ_GET_FIRMWARE;

CC Julia for possible improvements to the coccinelle script.  If it's
not convenient to fix there I'll teach the robot to ignore this
particular false warning.

Thanks,
Fengguang

>> coccinelle warnings: (new ones prefixed by >>)
>>
>> >> drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.
>>
>> vim +298 drivers/staging/greybus/bootrom.c
>>
>> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  282  		dev_err(dev, "%s: error allocating response\n", __func__);
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  283  		ret = -ENOMEM;
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  284  		goto unlock;
>> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  285  	}
>> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  286
>> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  287  	firmware_response = op->response->payload;
>> 98645a9c drivers/staging/greybus/firmware.c Johan Hovold 2015-11-19  288  	memcpy(firmware_response->data, fw->data + offset, size);
>> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  289
>> fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  290  	dev_dbg(dev, "responding with firmware (offs = %u, size = %u)\n", offset,
>> fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  291  		size);
>> fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  292
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  293  unlock:
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  294  	mutex_unlock(&bootrom->mutex);
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  295
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  296  queue_work:
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  297  	/* Refresh timeout */
>> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22 @298  	if (!ret && (offset + size == fw->size))
>> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  299  		next_request = NEXT_REQ_READY_TO_BOOT;
>> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  300  	else
>> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  301  		next_request = NEXT_REQ_GET_FIRMWARE;
>> a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  302
>> dbb8cfeb drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  303  	gb_bootrom_set_timeout(bootrom, next_request, NEXT_REQ_TIMEOUT_MS);
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  304
>> a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  305  	return ret;
>> 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  306  }
>>
>> :::::: The code at line 298 was first introduced by commit
>> :::::: a4293e1d4e6416477976ee3bd248589d3fc4bb19 greybus: bootrom: Enhance timeout error message
>>
>> :::::: TO: Viresh Kumar <viresh.kumar@linaro.org>
>> :::::: CC: Greg Kroah-Hartman <gregkh@google.com>
>>
>> ---
>> 0-DAY kernel test infrastructure                Open Source Technology Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1531136 — Re: [kbuild-all] drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.

FromFengguang Wu <fengguang.wu@intel.com>
Date2016-11-28 10:10 +0100
SubjectRe: [kbuild-all] drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.
Message-ID<sIq6J-8O-5@gated-at.bofh.it>
In reply to#1531108
On Mon, Nov 28, 2016 at 09:59:52AM +0100, Julia Lawall wrote:
>
>
>On Mon, 28 Nov 2016, Fengguang Wu wrote:
>
>> On Sun, Nov 27, 2016 at 12:06:33PM +0100, Greg KH wrote:
>> > On Sun, Nov 27, 2016 at 07:11:46AM +0800, kbuild test robot wrote:
>> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> > > master
>> > > head:   a0d60e62ea5c88a9823410e9d0929a513e29dea2
>> > > commit: f44dd184634d401f5cf88a6d8b4a60d5ff4f417f Merge greybus driver tree
>> > > into 4.8-rc6
>> > > date:   10 weeks ago
>> >
>> > This is a false-positive, sorry.
>>
>> Yes it's a false warning: ret != 0, so fw->size in the if test won't be
>> dereferenced.
>> Relevant code:
>>
>> if (!fw) {
>>                dev_err(dev, "%s: firmware not available\n", __func__);
>>                ret = -EINVAL;
>>                goto unlock;
>>        }
>> ...
>> unlock:
>>        mutex_unlock(&bootrom->mutex);
>>
>> queue_work:
>>        /* Refresh timeout */
>>        if (!ret && (offset + size == fw->size))
>>                next_request = NEXT_REQ_READY_TO_BOOT;
>>        else
>>                next_request = NEXT_REQ_GET_FIRMWARE;
>>
>> CC Julia for possible improvements to the coccinelle script.  If it's
>> not convenient to fix there I'll teach the robot to ignore this
>> particular false warning.
>
>This looks like it depends on analyzing the values of variables.
>
>It may be best to teach the robot to avoid this warning.  I can check
>these reports if needed for this problem.

OK. I'll send this kind of warnings to you instead of directly
reporting to the developer. Hope it's not a big burden on you.

Thanks,
Fengguang

>> > > coccinelle warnings: (new ones prefixed by >>)
>> > >
>> > > >> drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but
>> > > dereferenced.
>> > >
>> > > vim +298 drivers/staging/greybus/bootrom.c
>> > >
>> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  282
>> > > dev_err(dev, "%s: error allocating response\n", __func__);
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  283
>> > > ret = -ENOMEM;
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  284
>> > > goto unlock;
>> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  285
>> > > }
>> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  286
>> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  287
>> > > firmware_response = op->response->payload;
>> > > 98645a9c drivers/staging/greybus/firmware.c Johan Hovold 2015-11-19  288
>> > > memcpy(firmware_response->data, fw->data + offset, size);
>> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  289
>> > > fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  290
>> > > dev_dbg(dev, "responding with firmware (offs = %u, size = %u)\n", offset,
>> > > fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  291
>> > > size);
>> > > fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  292
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  293
>> > > unlock:
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  294
>> > > mutex_unlock(&bootrom->mutex);
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  295
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  296
>> > > queue_work:
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  297
>> > > /* Refresh timeout */
>> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22 @298
>> > > if (!ret && (offset + size == fw->size))
>> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  299
>> > > next_request = NEXT_REQ_READY_TO_BOOT;
>> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  300
>> > > else
>> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  301
>> > > next_request = NEXT_REQ_GET_FIRMWARE;
>> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  302
>> > > dbb8cfeb drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  303
>> > > gb_bootrom_set_timeout(bootrom, next_request, NEXT_REQ_TIMEOUT_MS);
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  304
>> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  305
>> > > return ret;
>> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  306
>> > > }
>> > >
>> > > :::::: The code at line 298 was first introduced by commit
>> > > :::::: a4293e1d4e6416477976ee3bd248589d3fc4bb19 greybus: bootrom: Enhance
>> > > timeout error message
>> > >
>> > > :::::: TO: Viresh Kumar <viresh.kumar@linaro.org>
>> > > :::::: CC: Greg Kroah-Hartman <gregkh@google.com>
>> > >
>> > > ---
>> > > 0-DAY kernel test infrastructure                Open Source Technology
>> > > Center
>> > > https://lists.01.org/pipermail/kbuild-all                   Intel
>> > > Corporation
>>
>_______________________________________________
>kbuild-all mailing list
>kbuild-all@lists.01.org
>https://lists.01.org/mailman/listinfo/kbuild-all

[toc] | [prev] | [next] | [standalone]


#1531138 — Re: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-11-28 10:10 +0100
SubjectRe: drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but dereferenced.
Message-ID<sIq6J-8O-7@gated-at.bofh.it>
In reply to#1531108

On Mon, 28 Nov 2016, Fengguang Wu wrote:

> On Sun, Nov 27, 2016 at 12:06:33PM +0100, Greg KH wrote:
> > On Sun, Nov 27, 2016 at 07:11:46AM +0800, kbuild test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > > master
> > > head:   a0d60e62ea5c88a9823410e9d0929a513e29dea2
> > > commit: f44dd184634d401f5cf88a6d8b4a60d5ff4f417f Merge greybus driver tree
> > > into 4.8-rc6
> > > date:   10 weeks ago
> >
> > This is a false-positive, sorry.
>
> Yes it's a false warning: ret != 0, so fw->size in the if test won't be
> dereferenced.
> Relevant code:
>
> if (!fw) {
>                dev_err(dev, "%s: firmware not available\n", __func__);
>                ret = -EINVAL;
>                goto unlock;
>        }
> ...
> unlock:
>        mutex_unlock(&bootrom->mutex);
>
> queue_work:
>        /* Refresh timeout */
>        if (!ret && (offset + size == fw->size))
>                next_request = NEXT_REQ_READY_TO_BOOT;
>        else
>                next_request = NEXT_REQ_GET_FIRMWARE;
>
> CC Julia for possible improvements to the coccinelle script.  If it's
> not convenient to fix there I'll teach the robot to ignore this
> particular false warning.

This looks like it depends on analyzing the values of variables.

It may be best to teach the robot to avoid this warning.  I can check
these reports if needed for this problem.

julia

>
> Thanks,
> Fengguang
>
> > > coccinelle warnings: (new ones prefixed by >>)
> > >
> > > >> drivers/staging/greybus/bootrom.c:298:35-39: ERROR: fw is NULL but
> > > dereferenced.
> > >
> > > vim +298 drivers/staging/greybus/bootrom.c
> > >
> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  282
> > > dev_err(dev, "%s: error allocating response\n", __func__);
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  283
> > > ret = -ENOMEM;
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  284
> > > goto unlock;
> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  285
> > > }
> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  286
> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  287
> > > firmware_response = op->response->payload;
> > > 98645a9c drivers/staging/greybus/firmware.c Johan Hovold 2015-11-19  288
> > > memcpy(firmware_response->data, fw->data + offset, size);
> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  289
> > > fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  290
> > > dev_dbg(dev, "responding with firmware (offs = %u, size = %u)\n", offset,
> > > fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  291
> > > size);
> > > fc41c2da drivers/staging/greybus/firmware.c Eli Sennesh  2016-01-08  292
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  293
> > > unlock:
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  294
> > > mutex_unlock(&bootrom->mutex);
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  295
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  296
> > > queue_work:
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  297
> > > /* Refresh timeout */
> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22 @298
> > > if (!ret && (offset + size == fw->size))
> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  299
> > > next_request = NEXT_REQ_READY_TO_BOOT;
> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  300
> > > else
> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  301
> > > next_request = NEXT_REQ_GET_FIRMWARE;
> > > a4293e1d drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  302
> > > dbb8cfeb drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-06-22  303
> > > gb_bootrom_set_timeout(bootrom, next_request, NEXT_REQ_TIMEOUT_MS);
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  304
> > > a956d939 drivers/staging/greybus/bootrom.c  Viresh Kumar 2016-05-09  305
> > > return ret;
> > > 90f1b617 drivers/staging/greybus/firmware.c Viresh Kumar 2015-08-12  306
> > > }
> > >
> > > :::::: The code at line 298 was first introduced by commit
> > > :::::: a4293e1d4e6416477976ee3bd248589d3fc4bb19 greybus: bootrom: Enhance
> > > timeout error message
> > >
> > > :::::: TO: Viresh Kumar <viresh.kumar@linaro.org>
> > > :::::: CC: Greg Kroah-Hartman <gregkh@google.com>
> > >
> > > ---
> > > 0-DAY kernel test infrastructure                Open Source Technology
> > > Center
> > > https://lists.01.org/pipermail/kbuild-all                   Intel
> > > Corporation
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web