* [stable:linux-4.9.y 66/1284] drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types)
@ 2020-12-11 14:26 kernel test robot
2020-12-12 14:21 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2020-12-11 14:26 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2964 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y
head: 5d55c2adbefeb2d49d16891ed8ca8d03789fd31b
commit: 980eaca9a409208439c84f7860202d61e31d225f [66/1284] iio:magnetometer:ak8974: Fix alignment and data leak issues
config: nios2-randconfig-s031-20201209 (attached as .config)
compiler: nios2-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-179-ga00755aa-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=980eaca9a409208439c84f7860202d61e31d225f
git remote add stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch --no-tags stable linux-4.9.y
git checkout 980eaca9a409208439c84f7860202d61e31d225f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/iio/magnetometer/ak8974.c:408:16: sparse: sparse: cast to restricted __le16
drivers/iio/magnetometer/ak8974.c:485:29: sparse: sparse: cast to restricted __le16
>> drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected signed short [usertype] *result @@ got restricted __le16 * @@
drivers/iio/magnetometer/ak8974.c:511:40: sparse: expected signed short [usertype] *result
drivers/iio/magnetometer/ak8974.c:511:40: sparse: got restricted __le16 *
vim +511 drivers/iio/magnetometer/ak8974.c
497
498 static void ak8974_fill_buffer(struct iio_dev *indio_dev)
499 {
500 struct ak8974 *ak8974 = iio_priv(indio_dev);
501 int ret;
502
503 pm_runtime_get_sync(&ak8974->i2c->dev);
504 mutex_lock(&ak8974->lock);
505
506 ret = ak8974_trigmeas(ak8974);
507 if (ret) {
508 dev_err(&ak8974->i2c->dev, "error triggering measure\n");
509 goto out_unlock;
510 }
> 511 ret = ak8974_getresult(ak8974, ak8974->scan.channels);
512 if (ret) {
513 dev_err(&ak8974->i2c->dev, "error getting measures\n");
514 goto out_unlock;
515 }
516
517 iio_push_to_buffers_with_timestamp(indio_dev, &ak8974->scan,
518 iio_get_time_ns(indio_dev));
519
520 out_unlock:
521 mutex_unlock(&ak8974->lock);
522 pm_runtime_mark_last_busy(&ak8974->i2c->dev);
523 pm_runtime_put_autosuspend(&ak8974->i2c->dev);
524 }
525
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25286 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [stable:linux-4.9.y 66/1284] drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types)
2020-12-11 14:26 [stable:linux-4.9.y 66/1284] drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types) kernel test robot
@ 2020-12-12 14:21 ` Linus Walleij
2020-12-14 9:07 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2020-12-12 14:21 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
On Fri, Dec 11, 2020 at 3:27 PM kernel test robot <lkp@intel.com> wrote:
> "sparse warnings: (new ones prefixed by >>)"
> drivers/iio/magnetometer/ak8974.c:408:16: sparse: sparse: cast to restricted __le16
> drivers/iio/magnetometer/ak8974.c:485:29: sparse: sparse: cast to restricted __le16
> >> drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected signed short [usertype] *result @@ got restricted __le16 * @@
> drivers/iio/magnetometer/ak8974.c:511:40: sparse: expected signed short [usertype] *result
> drivers/iio/magnetometer/ak8974.c:511:40: sparse: got restricted __le16 *
I don't understand this, is sparse warning about implicit casting __le16
to signed short or the other way around?
It seems to me to reasonable to allow anyway, I don't even see how
we could avoid that except using explicit casts.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [stable:linux-4.9.y 66/1284] drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types)
2020-12-12 14:21 ` Linus Walleij
@ 2020-12-14 9:07 ` Jonathan Cameron
2020-12-14 9:17 ` Greg Kroah-Hartman
0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2020-12-14 9:07 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]
On Sat, 12 Dec 2020 15:21:10 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Dec 11, 2020 at 3:27 PM kernel test robot <lkp@intel.com> wrote:
>
> > "sparse warnings: (new ones prefixed by >>)"
> > drivers/iio/magnetometer/ak8974.c:408:16: sparse: sparse: cast to restricted __le16
> > drivers/iio/magnetometer/ak8974.c:485:29: sparse: sparse: cast to restricted __le16
> > >> drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected signed short [usertype] *result @@ got restricted __le16 * @@
> > drivers/iio/magnetometer/ak8974.c:511:40: sparse: expected signed short [usertype] *result
> > drivers/iio/magnetometer/ak8974.c:511:40: sparse: got restricted __le16 *
>
> I don't understand this, is sparse warning about implicit casting __le16
> to signed short or the other way around?
>
> It seems to me to reasonable to allow anyway, I don't even see how
> we could avoid that except using explicit casts.
Looks to me like we didn't bother backporting a tidy up of the endian
types in here to 4.9. That changed the argument types to reflect that they
were arrays of __le16.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/iio/magnetometer/ak8974.c?h=v5.10&id=7f709dcda46105f617329630d97f5c97cea5b068
Personally I'm not that bothered about leaving this in place.
I don't think its an actual bug after all.
Jonathan
>
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [stable:linux-4.9.y 66/1284] drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types)
2020-12-14 9:07 ` Jonathan Cameron
@ 2020-12-14 9:17 ` Greg Kroah-Hartman
2020-12-15 9:39 ` Rong Chen
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-14 9:17 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]
On Mon, Dec 14, 2020 at 09:07:35AM +0000, Jonathan Cameron wrote:
> On Sat, 12 Dec 2020 15:21:10 +0100
> Linus Walleij <linus.walleij@linaro.org> wrote:
>
> > On Fri, Dec 11, 2020 at 3:27 PM kernel test robot <lkp@intel.com> wrote:
> >
> > > "sparse warnings: (new ones prefixed by >>)"
> > > drivers/iio/magnetometer/ak8974.c:408:16: sparse: sparse: cast to restricted __le16
> > > drivers/iio/magnetometer/ak8974.c:485:29: sparse: sparse: cast to restricted __le16
> > > >> drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected signed short [usertype] *result @@ got restricted __le16 * @@
> > > drivers/iio/magnetometer/ak8974.c:511:40: sparse: expected signed short [usertype] *result
> > > drivers/iio/magnetometer/ak8974.c:511:40: sparse: got restricted __le16 *
> >
> > I don't understand this, is sparse warning about implicit casting __le16
> > to signed short or the other way around?
> >
> > It seems to me to reasonable to allow anyway, I don't even see how
> > we could avoid that except using explicit casts.
>
> Looks to me like we didn't bother backporting a tidy up of the endian
> types in here to 4.9. That changed the argument types to reflect that they
> were arrays of __le16.
>
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/iio/magnetometer/ak8974.c?h=v5.10&id=7f709dcda46105f617329630d97f5c97cea5b068
>
> Personally I'm not that bothered about leaving this in place.
> I don't think its an actual bug after all.
Agreed, dealing with old sparse issues on the stable kernel trees is not
a thing, I don't know why the lkp bot keeps emailing about them :(
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [stable:linux-4.9.y 66/1284] drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types)
2020-12-14 9:17 ` Greg Kroah-Hartman
@ 2020-12-15 9:39 ` Rong Chen
0 siblings, 0 replies; 5+ messages in thread
From: Rong Chen @ 2020-12-15 9:39 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1938 bytes --]
On 12/14/20 5:17 PM, Greg Kroah-Hartman wrote:
> On Mon, Dec 14, 2020 at 09:07:35AM +0000, Jonathan Cameron wrote:
>> On Sat, 12 Dec 2020 15:21:10 +0100
>> Linus Walleij <linus.walleij@linaro.org> wrote:
>>
>>> On Fri, Dec 11, 2020 at 3:27 PM kernel test robot <lkp@intel.com> wrote:
>>>
>>>> "sparse warnings: (new ones prefixed by >>)"
>>>> drivers/iio/magnetometer/ak8974.c:408:16: sparse: sparse: cast to restricted __le16
>>>> drivers/iio/magnetometer/ak8974.c:485:29: sparse: sparse: cast to restricted __le16
>>>>>> drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected signed short [usertype] *result @@ got restricted __le16 * @@
>>>> drivers/iio/magnetometer/ak8974.c:511:40: sparse: expected signed short [usertype] *result
>>>> drivers/iio/magnetometer/ak8974.c:511:40: sparse: got restricted __le16 *
>>> I don't understand this, is sparse warning about implicit casting __le16
>>> to signed short or the other way around?
>>>
>>> It seems to me to reasonable to allow anyway, I don't even see how
>>> we could avoid that except using explicit casts.
>> Looks to me like we didn't bother backporting a tidy up of the endian
>> types in here to 4.9. That changed the argument types to reflect that they
>> were arrays of __le16.
>>
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/iio/magnetometer/ak8974.c?h=v5.10&id=7f709dcda46105f617329630d97f5c97cea5b068
>>
>> Personally I'm not that bothered about leaving this in place.
>> I don't think its an actual bug after all.
> Agreed, dealing with old sparse issues on the stable kernel trees is not
> a thing, I don't know why the lkp bot keeps emailing about them :(
Hi Greg,
Sorry about that, we'll stop reporting these static analysis issues on
stable kernel trees.
Best Regards,
Rong Chen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-15 9:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-11 14:26 [stable:linux-4.9.y 66/1284] drivers/iio/magnetometer/ak8974.c:511:40: sparse: sparse: incorrect type in argument 2 (different base types) kernel test robot
2020-12-12 14:21 ` Linus Walleij
2020-12-14 9:07 ` Jonathan Cameron
2020-12-14 9:17 ` Greg Kroah-Hartman
2020-12-15 9:39 ` Rong Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.