All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Dan Carpenter <dan.carpenter@oracle.co>,
	linux-sparse@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: detecting misuse of of_get_property
Date: Tue, 29 Oct 2019 14:37:57 +0100	[thread overview]
Message-ID: <20191029133756.qpqk5vf6txapqm35@ltop.local> (raw)
In-Reply-To: <20191029125519.GA1705@kadam>

On Tue, Oct 29, 2019 at 03:55:19PM +0300, Dan Carpenter wrote:
> On Tue, Oct 29, 2019 at 12:47:50PM +0100, Luc Van Oostenryck wrote:
> > On Tue, Oct 29, 2019 at 01:50:58PM +0300, Dan Carpenter wrote:
> > > +static void match_of_get_property(const char *fn, struct expression *expr, void *unused)
> > > +{
> > > +	struct expression *left = expr->left;
> > > +	struct symbol *type;
> > > +
> > > +	type = get_type(left);
> > > +	if (!type || type->type != SYM_PTR)
> > > +		return;
> > > +	type = get_base_type(type);
> > > +	if (type_bits(type) == 8)
> > > +		return;
> > > +	if (type->type == SYM_RESTRICT)
> > > +		return;
> > 
> > Wouldn't this also silently accept assignments to any bitwise
> > type: __le32, __be16, ... ? 
> 
> It does, yes.  I'm not sure how big of an issue that is...

Probably not much if it's just a one shot for Rasmus and
probably not much more otherwise.

> I always
> just throw a check together and test it before I decide if it's worth
> investing more time into it.

Sure, but I was thinking about false negatives here.

Regards,
-- Luc

      reply	other threads:[~2019-10-29 13:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 19:32 detecting misuse of of_get_property Rasmus Villemoes
2019-10-28 22:49 ` Luc Van Oostenryck
2019-10-29  7:24   ` Rasmus Villemoes
2019-10-29 10:50 ` Dan Carpenter
2019-10-29 11:43   ` Rasmus Villemoes
2019-10-29 12:57     ` Dan Carpenter
2019-10-29 11:47   ` Luc Van Oostenryck
2019-10-29 12:55     ` Dan Carpenter
2019-10-29 13:37       ` Luc Van Oostenryck [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=20191029133756.qpqk5vf6txapqm35@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=dan.carpenter@oracle.co \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /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.