Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030178AbbFZOkn (ORCPT ); Fri, 26 Jun 2015 10:40:43 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:44928 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753372AbbFZOkf (ORCPT ); Fri, 26 Jun 2015 10:40:35 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-21-558d6461fd2d From: Daniel Granat To: Julia.Lawall@lip6.fr, cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Cc: Gilles.Muller@lip6.fr, nicolas.palix@imag.fr, k.wrona@samsung.com, k.kozlowski@samsung.com, Daniel Granat Subject: [PATCH v6] coccinelle: Improve checking for missing NULL terminators Date: Fri, 26 Jun 2015 16:39:53 +0200 Message-id: <1435329593-12481-1-git-send-email-d.granat@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xa7qJKb2hBj+PcVr82LSazWLCI2OL 2T8vMVkse3Ca0eL1C0OLU8v2M1lc3jWHzeLYy+VMDhwex461Mnvs3ZLl0bdlFaPHo2X3WTw+ b5ILYI3isklJzcksSy3St0vgyni8ajdrwWqBil2737A2MDbwdjFycEgImEh07WPsYuQEMsUk Ltxbz9bFyMUhJLCUUeL9g4vsIAkhgSYmiXezHUFsNgEtict3HjCB2CICvhIX9kxnAWlgFmhj lNjzuA2sQRgo8bHvElgRi4CqxPZNN8DivAIuEtOW7oHaJidx8thkVhCbU8BS4u2SrUwQyywk 7ryczTiBkXcBI8MqRtHU0uSC4qT0XEO94sTc4tK8dL3k/NxNjJDA+rKDcfExq0OMAhyMSjy8 M1p7QoVYE8uKK3MPMUpwMCuJ8PJF94YK8aYkVlalFuXHF5XmpBYfYpTmYFES5527632IkEB6 YklqdmpqQWoRTJaJg1OqgbG9Xz5nwwITj6uOYTOYD3wOZFoVOXNf/mumcmU/548/U1erba/3 W/5TIOL2ETW7WypdKiJ7T9iEGabtfOK/hCW052ys8uK7Lh+q2212HeEV+/649W6U77mr5hOO yK1csUZ9l2ThhdnWPfrruKYVKb6T03h60Wq58nXXlYkCSVv32pVse7h0xxMlluKMREMt5qLi RACYNxYaKAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2245 Lines: 96 Extend checking on tables containing structures which are initialized without specifying member name. Added new tables for checking: i2c_device_id and platform_device_id. Signed-off-by: Daniel Granat Acked-by: Julia Lawall --- scripts/coccinelle/misc/of_table.cocci | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci index 3c93404..2294915 100644 --- a/scripts/coccinelle/misc/of_table.cocci +++ b/scripts/coccinelle/misc/of_table.cocci @@ -1,6 +1,6 @@ -/// Make sure of_device_id tables are NULL terminated +/// Make sure (of/i2c/platform)_device_id tables are NULL terminated // -// Keywords: of_table +// Keywords: of_table i2c_table platform_table // Confidence: Medium // Options: --include-headers @@ -13,18 +13,26 @@ virtual report identifier var, arr; expression E; @@ -struct of_device_id arr[] = { +( +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = { ..., { .var = E, * } }; +| +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = { + ..., +* { ..., E, ... }, +}; +) @depends on patch@ identifier var, arr; expression E; @@ -struct of_device_id arr[] = { +( +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = { ..., { .var = E, @@ -32,19 +40,34 @@ struct of_device_id arr[] = { + }, + { } }; +| +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = { + ..., + { ..., E, ... }, ++ { }, +}; +) @r depends on org || report@ position p1; identifier var, arr; expression E; @@ -struct of_device_id arr[] = { +( +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = { ..., { .var = E, } @p1 }; +| +struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = { + ..., + { ..., E, ... } + @p1 +}; +) @script:python depends on org@ p1 << r.p1; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/