From: Dan Carpenter <dan.carpenter@oracle.com>
To: anish kumar <anish198519851985@gmail.com>
Cc: Anton Vorontsov <cbou@mail.ru>,
David Woodhouse <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] power: battery: pointer math issue in gab_probe()
Date: Sun, 30 Sep 2012 07:06:46 +0000 [thread overview]
Message-ID: <20120930070646.GO4587@mwanda> (raw)
In-Reply-To: <1348978125.7492.2.camel@anish-Inspiron-N5050>
On Sun, Sep 30, 2012 at 09:38:45AM +0530, anish kumar wrote:
> On Sat, 2012-09-29 at 10:13 +0300, Dan Carpenter wrote:
> > psy->properties is an enum (32 bit type) so adding sizeof() puts us
> > four times further along than we intended. It should be cast to a char
> > pointer before doing the math.
> You really read this driver to find out this one.
> Good one.
Nah. It's a static checker thing with Smatch
(http://smatch.sf.net). When you add pointer + sizeof(), the
pointer should always be char.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: anish kumar <anish198519851985@gmail.com>
Cc: Anton Vorontsov <cbou@mail.ru>,
David Woodhouse <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] power: battery: pointer math issue in gab_probe()
Date: Sun, 30 Sep 2012 10:06:46 +0300 [thread overview]
Message-ID: <20120930070646.GO4587@mwanda> (raw)
In-Reply-To: <1348978125.7492.2.camel@anish-Inspiron-N5050>
On Sun, Sep 30, 2012 at 09:38:45AM +0530, anish kumar wrote:
> On Sat, 2012-09-29 at 10:13 +0300, Dan Carpenter wrote:
> > psy->properties is an enum (32 bit type) so adding sizeof() puts us
> > four times further along than we intended. It should be cast to a char
> > pointer before doing the math.
> You really read this driver to find out this one.
> Good one.
Nah. It's a static checker thing with Smatch
(http://smatch.sf.net). When you add pointer + sizeof(), the
pointer should always be char.
regards,
dan carpenter
next prev parent reply other threads:[~2012-09-30 7:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-29 7:13 [patch] power: battery: pointer math issue in gab_probe() Dan Carpenter
2012-09-29 7:13 ` Dan Carpenter
2012-09-30 4:08 ` anish kumar
2012-09-30 4:20 ` anish kumar
2012-09-30 7:06 ` Dan Carpenter [this message]
2012-09-30 7:06 ` Dan Carpenter
2012-11-05 12:34 ` anish kumar
2012-11-05 12:34 ` anish kumar
2012-11-05 13:09 ` Dan Carpenter
2012-11-05 13:09 ` Dan Carpenter
2012-11-05 18:37 ` Anton Vorontsov
2012-11-05 18:37 ` Anton Vorontsov
2012-11-17 2:36 ` Anton Vorontsov
2012-11-17 2:36 ` Anton Vorontsov
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=20120930070646.GO4587@mwanda \
--to=dan.carpenter@oracle.com \
--cc=anish198519851985@gmail.com \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.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 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.