All of lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] array index range checking
Date: Fri, 22 May 2015 07:47:44 +0200	[thread overview]
Message-ID: <555EC300.50503@users.sourceforge.net> (raw)
In-Reply-To: <CABBGRWtnRi0UmDeaemtx-=S8bznO2K-_8jjB_v9sEgHnQUN9QQ@mail.gmail.com>

> i tried this script
>
> @r@
> position p1;
> identifier  arr;
> constant i , var;
> type T;
> @@
>  T arr[var];

Does this SmPL approach work a bit as you expect?
Which details did not satisfy you so far?


> ... when != (i < var/ )

How do you think about to omit parentheses here?


> ...
> * arr[i]@p1

Would you like to reuse the data from the position variable anywhere?

How do you want to handle scopes for the involved array indexes?
http://en.cppreference.com/w/c/language/scope

Regards,
Markus

  reply	other threads:[~2015-05-22  5:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 10:19 [Cocci] array addressing range checking by coccinelle Zied Habtoul
2015-05-21 21:13 ` [Cocci] array index range checking SF Markus Elfring
2015-05-21 21:55   ` Zied Habtoul
2015-05-22  5:47     ` SF Markus Elfring [this message]
2015-05-22  8:59       ` Zied Habtoul
2015-05-22 10:05         ` SF Markus Elfring
2015-05-22 10:13           ` Zied Habtoul
2015-05-22 10:40             ` SF Markus Elfring
2015-05-22 11:11             ` Julia Lawall
2015-05-22 11:53               ` SF Markus Elfring

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=555EC300.50503@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=cocci@systeme.lip6.fr \
    /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.