From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754645AbbAUQyx (ORCPT ); Wed, 21 Jan 2015 11:54:53 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:37326 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754231AbbAUQwl (ORCPT ); Wed, 21 Jan 2015 11:52:41 -0500 X-AuditID: cbfec7f5-b7fc86d0000066b7-bc-54bfd8be9100 From: Andrey Ryabinin To: linux-kernel@vger.kernel.org Cc: Andrey Ryabinin , Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Andrew Morton , Dave Hansen , Andi Kleen , x86@kernel.org, linux-mm@kvack.org, Rusty Russell Subject: [PATCH v9 16/17] module: fix types of device tables aliases Date: Wed, 21 Jan 2015 19:51:44 +0300 Message-id: <1421859105-25253-17-git-send-email-a.ryabinin@samsung.com> X-Mailer: git-send-email 2.2.1 In-reply-to: <1421859105-25253-1-git-send-email-a.ryabinin@samsung.com> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1421859105-25253-1-git-send-email-a.ryabinin@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xq7r7buwPMXi8l8Vi269HbBa/985k tZizfg2bxZFr39ktrn97w2jx6eUDRovnDx+yW0x42MZusbK7mc1i+7O3TBYrOx+wWlzeNYfN 4t6a/6wWN6ddYLFYfOQ2s8W7Z5OZLX5seMzqIOgxf+dHRo+ds+6yeyzYVOqxeM9LJo9NqzrZ PDZ9msTu0fX2CpPHiRm/WTyeXJnO5PHx6S0WjxUbTjB79G1ZxejxeZNcAG8Ul01Kak5mWWqR vl0CV8apJbeZCh5zVuy4doK1gXEeRxcjJ4eEgIlE96QD7BC2mMSFe+vZuhi5OIQEljJKXN7x nhnC6WOSeNn2ihmkik1AT+LfrO1sILaIgILE5t5nrCBFzALnWSSeHzoOlhAWcJFYu2UzC4jN IqAqcebCN1YQm1fAXWLtuaNQ6+QkNt5ZARbnBIrPPD+RCWJbE6PE5yPb2SYw8i5gZFjFKJpa mlxQnJSea6RXnJhbXJqXrpecn7uJERINX3cwLj1mdYhRgINRiYdXwmd/iBBrYllxZe4hRgkO ZiUR3vnXgUK8KYmVValF+fFFpTmpxYcYmTg4pRoYD904/ay3pkOXe/kWic3+cSqO5XH+S+49 uj7Bac6qvn/nD6pt2jux/UtA2Ov67g0bzA4UeuuxstZwmSl6hFveffiBdbqXuTsz21eTd2L/ GuS23FE94RG4Mt5Jp2hzgvttQ3kWqcJlgj172xkUT1/i/nyOc4ud/E75BKvMurdq7efaxRpF FxspsRRnJBpqMRcVJwIAFYPCWmQCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MODULE_DEVICE_TABLE() macro used to create aliases to device tables. Normally alias should have the same type as aliased symbol. Device tables are arrays, so they have 'struct type##_device_id[x]' types. Alias created by MODULE_DEVICE_TABLE() will have non-array type - 'struct type##_device_id'. This inconsistency confuses compiler, it could make a wrong assumption about variable's size which leads KASan to produce a false positive report about out of bounds access. Signed-off-by: Andrey Ryabinin --- include/linux/module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/module.h b/include/linux/module.h index ebfb0e1..54e75a7 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -135,7 +135,7 @@ void trim_init_extable(struct module *m); #ifdef MODULE /* Creates an alias so file2alias.c can find device table. */ #define MODULE_DEVICE_TABLE(type, name) \ - extern const struct type##_device_id __mod_##type##__##name##_device_table \ +extern typeof(name) __mod_##type##__##name##_device_table \ __attribute__ ((unused, alias(__stringify(name)))) #else /* !MODULE */ #define MODULE_DEVICE_TABLE(type, name) -- 2.2.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by kanga.kvack.org (Postfix) with ESMTP id 1634C6B0087 for ; Wed, 21 Jan 2015 11:52:56 -0500 (EST) Received: by mail-pa0-f49.google.com with SMTP id fa1so2362037pad.8 for ; Wed, 21 Jan 2015 08:52:55 -0800 (PST) Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com. [210.118.77.14]) by mx.google.com with ESMTPS id lb5si8815824pbc.163.2015.01.21.08.52.35 for (version=TLSv1 cipher=RC4-MD5 bits=128/128); Wed, 21 Jan 2015 08:52:36 -0800 (PST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NIJ00GS1DQ8VXA0@mailout4.w1.samsung.com> for linux-mm@kvack.org; Wed, 21 Jan 2015 16:56:32 +0000 (GMT) From: Andrey Ryabinin Subject: [PATCH v9 16/17] module: fix types of device tables aliases Date: Wed, 21 Jan 2015 19:51:44 +0300 Message-id: <1421859105-25253-17-git-send-email-a.ryabinin@samsung.com> In-reply-to: <1421859105-25253-1-git-send-email-a.ryabinin@samsung.com> References: <1404905415-9046-1-git-send-email-a.ryabinin@samsung.com> <1421859105-25253-1-git-send-email-a.ryabinin@samsung.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org Cc: Andrey Ryabinin , Dmitry Vyukov , Konstantin Serebryany , Dmitry Chernenkov , Andrey Konovalov , Yuri Gribov , Konstantin Khlebnikov , Sasha Levin , Christoph Lameter , Joonsoo Kim , Andrew Morton , Dave Hansen , Andi Kleen , x86@kernel.org, linux-mm@kvack.org, Rusty Russell MODULE_DEVICE_TABLE() macro used to create aliases to device tables. Normally alias should have the same type as aliased symbol. Device tables are arrays, so they have 'struct type##_device_id[x]' types. Alias created by MODULE_DEVICE_TABLE() will have non-array type - 'struct type##_device_id'. This inconsistency confuses compiler, it could make a wrong assumption about variable's size which leads KASan to produce a false positive report about out of bounds access. Signed-off-by: Andrey Ryabinin --- include/linux/module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/module.h b/include/linux/module.h index ebfb0e1..54e75a7 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -135,7 +135,7 @@ void trim_init_extable(struct module *m); #ifdef MODULE /* Creates an alias so file2alias.c can find device table. */ #define MODULE_DEVICE_TABLE(type, name) \ - extern const struct type##_device_id __mod_##type##__##name##_device_table \ +extern typeof(name) __mod_##type##__##name##_device_table \ __attribute__ ((unused, alias(__stringify(name)))) #else /* !MODULE */ #define MODULE_DEVICE_TABLE(type, name) -- 2.2.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org