LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Julia Lawall <julia@diku.dk>
To: vladislav.yasevich@hp.com, sri@us.ibm.com,
	lksctp-developers@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 8/8] : Use FIELD_SIZEOF
Date: Sun, 10 Feb 2008 21:16:04 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0802102115100.23906@ask.diku.dk> (raw)

From: Julia Lawall <julia@diku.dk>

Robert P.J. Day proposed to use the macro FIELD_SIZEOF in replace of code
that matches its definition.

The modification was made using the following semantic patch
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

#include <linux/kernel.h>

@depends on haskernel@
type t;
identifier f;
@@

- (sizeof(((t*)0)->f))
+ FIELD_SIZEOF(t, f)

@depends on haskernel@
type t;
identifier f;
@@

- sizeof(((t*)0)->f)
+ FIELD_SIZEOF(t, f)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---

diff -u -p a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
--- a/include/net/sctp/sctp.h 2008-02-10 17:13:55.000000000 +0100
+++ b/include/net/sctp/sctp.h 2008-02-10 18:27:30.000000000 +0100
@@ -618,7 +618,7 @@ static inline int param_type2af(__be16 t
 static inline int sctp_sanity_check(void)
 {
 	SCTP_ASSERT(sizeof(struct sctp_ulpevent) <=
-		    sizeof(((struct sk_buff *)0)->cb),
+		    FIELD_SIZEOF(struct sk_buff, cb),
 		    "SCTP: ulpevent does not fit in skb!\n", return 0);
 
 	return 1;

             reply	other threads:[~2008-02-10 20:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-10 20:16 Julia Lawall [this message]
2008-02-10 21:12 ` Alexey Dobriyan
2008-02-11  2:23   ` [Lksctp-developers] " Vlad Yasevich

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=Pine.LNX.4.64.0802102115100.23906@ask.diku.dk \
    --to=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lksctp-developers@lists.sourceforge.net \
    --cc=sri@us.ibm.com \
    --cc=vladislav.yasevich@hp.com \
    --subject='Re: [PATCH 8/8] : Use FIELD_SIZEOF' \
    /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

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).