From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: sayli karnik <karniksayli1995@gmail.com>
Cc: outreachy-kernel@googlegroups.com,
"Laura Abbott" <labbott@redhat.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Riley Andrews" <riandrews@android.com>
Subject: Re: [PATCH] staging: android: ion: hisilicon: Use pointer to memory being allocated as the sizeof argument
Date: Wed, 21 Sep 2016 18:41:40 +0200 [thread overview]
Message-ID: <20160921164140.GA9768@kroah.com> (raw)
In-Reply-To: <CAKG5xWgV-0cKboce8i8LbLB7kBQPMYs_NjcredvggXX6Qb=UGA@mail.gmail.com>
On Wed, Sep 21, 2016 at 10:01:09PM +0530, sayli karnik wrote:
> On Wed, Sep 21, 2016 at 9:45 PM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Wed, Sep 21, 2016 at 09:11:14PM +0530, sayli karnik wrote:
> >> This patch finds cases where the argument to sizeof is wrong in memory
> >> allocation functions by checking the type of the allocated memory when it is a
> >> double pointer and ensuring the sizeof argument takes a pointer to the memory
> >> being allocated.
> >
> > Are you sure?
> >
> This was detected by scripts/coccinelle/misc/badty.cocci, which
> specifies that a false positive only arises when the sizeof argument
> is not used in constructing the return value. Also the driver builds
> without errors. What do you think?
building without errors is not the issue here at all, it's a number that
is being passed in, you could replace that statement with "42" and it
would still build.
But would it work when running? That's the question here :)
Please look at the surrounding code and see if it is correct or not,
somehow it is working as-is, right? Are we just allocating too much
memory?
Pointer math is tricky at times, I can understand coccinelle scripts
getting confused here...
thanks,
greg k-h
prev parent reply other threads:[~2016-09-21 16:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 15:41 [PATCH] staging: android: ion: hisilicon: Use pointer to memory being allocated as the sizeof argument sayli karnik
2016-09-21 16:15 ` Greg Kroah-Hartman
2016-09-21 16:31 ` sayli karnik
2016-09-21 16:36 ` [Outreachy kernel] " Julia Lawall
2016-09-21 16:41 ` Greg Kroah-Hartman [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=20160921164140.GA9768@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arve@android.com \
--cc=karniksayli1995@gmail.com \
--cc=labbott@redhat.com \
--cc=outreachy-kernel@googlegroups.com \
--cc=riandrews@android.com \
--cc=sumit.semwal@linaro.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.