Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1648228 > unrolled thread

[PATCH v3 0/2] kernel.h: container_of() pointer checking

Started byIan Abbott <abbotti@mev.co.uk>
First post2017-05-23 18:00 +0200
Last post2017-05-23 18:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/2] kernel.h: container_of() pointer checking Ian Abbott <abbotti@mev.co.uk> - 2017-05-23 18:00 +0200

#1648228 — [PATCH v3 0/2] kernel.h: container_of() pointer checking

FromIan Abbott <abbotti@mev.co.uk>
Date2017-05-23 18:00 +0200
Subject[PATCH v3 0/2] kernel.h: container_of() pointer checking
Message-ID<tKko1-5cc-5@gated-at.bofh.it>
[Apologies for the resend.  I got both mailing list addresses wrong!]

Patch 2 changes the container_of() macro to improve the compatibility
checking when the member has array type.  As a bonus (?), if the pointer
neither points to a type compatible with the member nor points to a type
compatible with void, compiler errors are produced instead of warnings.

Patch 1 is a prerequisite to avoid a lot of warnings when <linux/bug.h>
is included by <linux/kernel.h>.

1) asm-generic/bug.h: declare struct pt_regs; before function prototype
2) kernel.h: handle pointers to arrays better in container_of()

 include/asm-generic/bug.h | 1 +
 include/linux/kernel.h    | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web