From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763728AbdEWQBZ (ORCPT ); Tue, 23 May 2017 12:01:25 -0400 Received: from smtp65.iad3a.emailsrvr.com ([173.203.187.65]:46326 "EHLO smtp65.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752522AbdEWQBX (ORCPT ); Tue, 23 May 2017 12:01:23 -0400 X-Auth-ID: abbotti@mev.co.uk X-Sender-Id: abbotti@mev.co.uk From: Ian Abbott To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: Arnd Bergmann , Andrew Morton , Michal Nazarewicz , Hidehiro Kawai , Borislav Petkov , Rasmus Villemoes , Johannes Berg , Peter Zijlstra , Alexander Potapenko Subject: [PATCH v4 0/2] kernel.h: container_of() pointer checking Date: Tue, 23 May 2017 17:01:10 +0100 Message-Id: <20170523160112.3446-1-abbotti@mev.co.uk> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [I screwed up an 'Acked-by:' line on v3.] 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 is included by . 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(-)