From: Jonathan Cameron <jic23@kernel.org>
To: Paolo Cretaro <melko@frugalware.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Brian Masney <masneyb@onstation.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
simran singhal <singhalsimran0@gmail.com>,
Eva Rachel Retuya <eraretuya@gmail.com>,
Enric Balletbo i Serra <eballetbo@gmail.com>,
linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] staging: iio: tsl2x7x: clean up limit checks
Date: Sat, 16 Sep 2017 15:05:19 -0700 [thread overview]
Message-ID: <20170916150519.4564a279@archlinux> (raw)
In-Reply-To: <48e90a50-7fa1-8bef-368b-cffc0a6fcfd3@frugalware.org>
On Sat, 16 Sep 2017 14:18:52 +0200
Paolo Cretaro <melko@frugalware.org> wrote:
> On 16/09/2017 13:37, Dan Carpenter wrote:
> > On Sat, Sep 16, 2017 at 01:11:29PM +0200, Paolo Cretaro wrote:
> >> Hi Dan,
> >> just minor nitpicking on the commit message:
> >>
> >> On 08/09/2017 12:53, Dan Carpenter wrote:
> >>> The background of this code is that we can either use the default
> >>> tables or load our own table with sysfs. The default tables are three
> >>> element arrays of struct tsl2x7x_lux. If we load the table with sysfs
> >>> then we can have as many as nine elements. Which ever way we do it, the
> >>> last element is always zeroed out.
> >>>
> >>> The most interesting part of this patch is in the
> >>> in_illuminance0_lux_table_show() function. We were using the wrong
> >>> limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
> >>> "TSL2X7X_MAX_LUX_TABLE_SIZE". This creates a static checker warning
> >>> that we are going of of bounds. However, since the last element is
> >> out of bounds
> >>
> >> Regards,
> >> P.
> >>
> >>> always zeroed out, that means we hit the break statement and the code
> >>> works correctly despite the wrong limit check.
> >
> > What? No no. I meant it how I wrote it. The last element is
> > always zeroed out meaning it's just a series of zeroes.
>
> Sorry, I meant the previous sentence "This creates a static checker warning
> that we are going of of bounds".
Double of fixed and patch applied to the togreg branch of iio.git.
Thanks,
Jonathan
>
> Regards,
> P.
>
> >
> > regards,
> > dan carpenter
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-09-16 22:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 10:11 [PATCH] iio staging: tsl2x7x: clean up limit checks Dan Carpenter
2017-09-03 11:35 ` Jonathan Cameron
2017-09-04 2:12 ` Brian Masney
2017-09-05 14:58 ` Dan Carpenter
2017-09-05 21:02 ` Brian Masney
2017-09-05 23:31 ` Brian Masney
2017-09-06 12:41 ` Dan Carpenter
2017-09-08 10:53 ` [PATCH v2] staging: iio: " Dan Carpenter
2017-09-08 13:48 ` walter harms
2017-09-08 14:05 ` Dan Carpenter
2017-09-15 23:30 ` Brian Masney
2017-09-16 11:11 ` Paolo Cretaro
2017-09-16 11:37 ` Dan Carpenter
2017-09-16 12:18 ` Paolo Cretaro
2017-09-16 22:05 ` Jonathan Cameron [this message]
2017-09-18 9:58 ` Dan Carpenter
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=20170916150519.4564a279@archlinux \
--to=jic23@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=eballetbo@gmail.com \
--cc=eraretuya@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=masneyb@onstation.org \
--cc=melko@frugalware.org \
--cc=pmeerw@pmeerw.net \
--cc=singhalsimran0@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).