Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2248773ybt; Sun, 21 Jun 2020 13:58:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwn0wntvwKTGD9lo1iTv/L1OyKH+v07SXFSwrBPxza/v7SaX2B9hR7nBhGqTuQMNMx1jYV X-Received: by 2002:aa7:c3d3:: with SMTP id l19mr14538229edr.126.1592773110333; Sun, 21 Jun 2020 13:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592773110; cv=none; d=google.com; s=arc-20160816; b=Z42Ti9MwlyMuMCMa6Cz9krZl4pgIu7wmhcPnku6z7uy4h8JB5epA58dnWFoGsGQgrA NbBa3euR006PaU52YEOy9uxUZeRoLNZ/rN4eatKOk1/F4F2ZrJohK3bgalW+ynOCvTt1 5qqnwje7wxuAYCEMYlUddj1M2i8bPWCs44temUzyG+81jOicIK3pOf/N8sjDxAgW/+Z7 FE7s4eRQyE/VqM40lwWfa8I79yelzjDUfEHY2AjYGZ3Kmf2IwFUriSDME0qKb+peiyeF zgw/CHhuuHVEdiqX50g6NbgRTQ71p7XJzt/SoPTXCk8SVcT4RFI+Vn8WVqE9IgCXvpWS LprQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=E0ztuGPvfNntezuTloeD8m0F96w3UobG0bcx0R5ChWw=; b=Fe+N1uAYM+vWQUkUw9u5zgu6QL4MiLzvY6o3ltpCvtUvQ5/YzOuR2MY5wcDTZk6Vhb 8jwQhZX9wIwcKHA0ZgzdSk08/8aMPZXQasHULIp/laf4W5lGOcQjqIwGmCdG9lHc6xkD VGgViJQDDeiP1yrVjWvGLNVHjkT8aqYSCd/LuoTTh8GtnslaDx+8GMiekMtFsEYS8Gra q61tpEbPNG7ulE3MPFy43A/TW1qcjjuW9Nje9ozZeih+nZ+fUv8cBSHQ8KsOs6RAQHm6 /H/TVHmc7mReWY7f/uwJnpsXbwK4EonoKzrToWf82OafXJJCFKEWxXAk6PmE7YtNXiz1 1FNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc20si8693631edb.108.2020.06.21.13.58.08; Sun, 21 Jun 2020 13:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728860AbgFUU4K (ORCPT + 99 others); Sun, 21 Jun 2020 16:56:10 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:45548 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728549AbgFUU4K (ORCPT ); Sun, 21 Jun 2020 16:56:10 -0400 X-IronPort-AV: E=Sophos;i="5.75,264,1589234400"; d="scan'208";a="455861323" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2020 22:56:07 +0200 Date: Sun, 21 Jun 2020 22:56:07 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Denis Efremov cc: Kees Cook , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [Cocci] [PATCH v3] coccinelle: misc: add array_size_dup script to detect missed overflow checks In-Reply-To: <20200619131313.15468-1-efremov@linux.com> Message-ID: References: <20200615102045.4558-1-efremov@linux.com> <20200619131313.15468-1-efremov@linux.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +@script:python depends on report@ > +p1 << as_next.p1; > +p2 << as_next.p2; > +@@ > + > +coccilib.report.print_report(p1[0], > +f"WARNING: array_size is used down the code (line {p2[0].line}) to compute the same size") I get python failures for all of these messages. I know nothing about python. How is this supposed to work? Is it a python 2 vs python 3 thing? julia > + > +@script:python depends on org@ > +p1 << as_next.p1; > +p2 << as_next.p2; > +@@ > + > +coccilib.org.print_todo(p1[0], > +f"WARNING: array_size is used down the code (line {p2[0].line}) to compute the same size") > + > +@as_prev@ > +expression subE1 <= as.E1; > +expression subE2 <= as.E2; > +expression as.E1, as.E2, E3; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* array_size(E1, E2)@p1 > + ... when != \(E1\|E2\|subE1\|subE2\) aop E3 > + when != &\(E1\|E2\|subE1\|subE2\) > +* E1 * E2@p2 > + > +@script:python depends on report@ > +p1 << as_prev.p1; > +p2 << as_prev.p2; > +@@ > + > +coccilib.report.print_report(p2[0], > +f"WARNING: array_size is already used (line {p1[0].line}) to compute the same size") > + > +@script:python depends on org@ > +p1 << as_prev.p1; > +p2 << as_prev.p2; > +@@ > + > +coccilib.org.print_todo(p2[0], > +f"WARNING: array_size is already used (line {p1[0].line}) to compute the same size") > + > +@as_dup@ > +expression subE1 <= as.E1; > +expression subE2 <= as.E2; > +expression as.E1, as.E2, E3; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* array_size(E1, E2)@p1 > + ... when != \(E1\|E2\|subE1\|subE2\) aop E3 > + when != &\(E1\|E2\|subE1\|subE2\) > +* array_size(E1, E2)@p2 > + > +@script:python depends on report@ > +p1 << as_dup.p1; > +p2 << as_dup.p2; > +@@ > + > +coccilib.report.print_report(p2[0], > +f"WARNING: same array_size (line {p1[0].line})") > + > +@script:python depends on org@ > +p1 << as_dup.p1; > +p2 << as_dup.p2; > +@@ > + > +coccilib.org.print_todo(p2[0], > +f"WARNING: same array_size (line {p1[0].line})") > + > +@as3@ > +expression E1, E2, E3; > +@@ > + > +array3_size(E1, E2, E3) > + > +@as3_next@ > +expression subE1 <= as3.E1; > +expression subE2 <= as3.E2; > +expression subE3 <= as3.E3; > +expression as3.E1, as3.E2, as3.E3, E4; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* E1 * E2 * E3@p1 > + ... when != \(E1\|E2\|E3\|subE1\|subE2\|subE3\) aop E4 > + when != &\(E1\|E2\|E3\|subE1\|subE2\|subE3\) > +* array3_size(E1, E2, E3)@p2 > + > +@script:python depends on report@ > +p1 << as3_next.p1; > +p2 << as3_next.p2; > +@@ > + > +coccilib.report.print_report(p1[0], > +f"WARNING: array3_size is used down the code (line {p2[0].line}) to compute the same size") > + > +@script:python depends on org@ > +p1 << as3_next.p1; > +p2 << as3_next.p2; > +@@ > + > +coccilib.org.print_todo(p1[0], > +f"WARNING: array3_size is used down the code (line {p2[0].line}) to compute the same size") > + > +@as3_prev@ > +expression subE1 <= as3.E1; > +expression subE2 <= as3.E2; > +expression subE3 <= as3.E3; > +expression as3.E1, as3.E2, as3.E3, E4; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* array3_size(E1, E2, E3)@p1 > + ... when != \(E1\|E2\|E3\|subE1\|subE2\|subE3\) aop E4 > + when != &\(E1\|E2\|E3\|subE1\|subE2\|subE3\) > +* E1 * E2 * E3@p2 > + > +@script:python depends on report@ > +p1 << as3_prev.p1; > +p2 << as3_prev.p2; > +@@ > + > +coccilib.report.print_report(p2[0], > +f"WARNING: array3_size is already used (line {p1[0].line}) to compute the same size") > + > +@script:python depends on org@ > +p1 << as3_prev.p1; > +p2 << as3_prev.p2; > +@@ > + > +coccilib.org.print_todo(p2[0], > +f"WARNING: array3_size is already used (line {p1[0].line}) to compute the same size") > + > +@as3_dup@ > +expression subE1 <= as3.E1; > +expression subE2 <= as3.E2; > +expression subE3 <= as3.E3; > +expression as3.E1, as3.E2, as3.E3, E4; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* array3_size(E1, E2, E3)@p1 > + ... when != \(E1\|E2\|E3\|subE1\|subE2\|subE3\) aop E4 > + when != &\(E1\|E2\|E3\|subE1\|subE2\|subE3\) > +* array3_size(E1, E2, E3)@p2 > + > +@script:python depends on report@ > +p1 << as3_dup.p1; > +p2 << as3_dup.p2; > +@@ > + > +coccilib.report.print_report(p2[0], > +f"WARNING: same array3_size (line {p1[0].line})") > + > +@script:python depends on org@ > +p1 << as3_dup.p1; > +p2 << as3_dup.p2; > +@@ > + > +coccilib.org.print_todo(p2[0], > +f"WARNING: same array3_size (line {p1[0].line})") > + > +@ss@ > +expression E1, E2, E3; > +@@ > + > +struct_size(E1, E2, E3) > + > +@ss_next@ > +expression subE3 <= ss.E3; > +expression ss.E1, ss.E2, ss.E3, E4; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* E1 * E2 + E3@p1 > + ... when != \(E3\|subE3\) aop E4 > + when != &\(E3\|subE3\) > +* struct_size(E1, E2, E3)@p2 > + > +@script:python depends on report@ > +p1 << ss_next.p1; > +p2 << ss_next.p2; > +@@ > + > +coccilib.report.print_report(p1[0], > +f"WARNING: struct_size is used down the code (line {p2[0].line}) to compute the same size") > + > +@script:python depends on org@ > +p1 << ss_next.p1; > +p2 << ss_next.p2; > +@@ > + > +coccilib.org.print_todo(p1[0], > +f"WARNING: struct_size is used down the code (line {p2[0].line}) to compute the same size") > + > +@ss_prev@ > +expression subE3 <= ss.E3; > +expression ss.E1, ss.E2, ss.E3, E4; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* struct_size(E1, E2, E3)@p1 > + ... when != \(E3\|subE3\) aop E4 > + when != &\(E3\|subE3\) > +* E1 * E2 + E3@p2 > + > +@script:python depends on report@ > +p1 << ss_prev.p1; > +p2 << ss_prev.p2; > +@@ > + > +coccilib.report.print_report(p2[0], > +f"WARNING: struct_size is already used (line {p1[0].line}) to compute the same size") > + > +@script:python depends on org@ > +p1 << ss_prev.p1; > +p2 << ss_prev.p2; > +@@ > + > +coccilib.org.print_todo(p2[0], > +f"WARNING: struct_size is already used (line {p1[0].line}) to compute the same size") > + > +@ss_dup@ > +expression subE3 <= ss.E3; > +expression ss.E1, ss.E2, ss.E3, E4; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* struct_size(E1, E2, E3)@p1 > + ... when != \(E3\|subE3\) aop E4 > + when != &\(E3\|subE3\) > +* struct_size(E1, E2, E3)@p2 > + > +@script:python depends on report@ > +p1 << ss_dup.p1; > +p2 << ss_dup.p2; > +@@ > + > +coccilib.report.print_report(p2[0], > +f"WARNING: same struct_size (line {p1[0].line})") > + > +@script:python depends on org@ > +p1 << ss_dup.p1; > +p2 << ss_dup.p2; > +@@ > + > +coccilib.org.print_todo(p2[0], > +f"WARNING: same struct_size (line {p1[0].line})") > -- > 2.26.2 > > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci >