From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751748AbbIZHph (ORCPT ); Sat, 26 Sep 2015 03:45:37 -0400 Received: from mout.web.de ([212.227.17.12]:51495 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395AbbIZHpf (ORCPT ); Sat, 26 Sep 2015 03:45:35 -0400 Subject: Re: [PATCH] coccinelle: assign signed result to unsigned variable To: Andrzej Hajda References: <1443099286-16559-1-git-send-email-a.hajda@samsung.com> <56041BE5.5010005@users.sourceforge.net> <56051D2B.5040802@samsung.com> Cc: Bartlomiej Zolnierkiewicz , Gilles Muller , Marek Szyprowski , Michal Marek , Nicolas Palix , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr From: SF Markus Elfring X-Enigmail-Draft-Status: N1110 Message-ID: <56064D0B.8060907@users.sourceforge.net> Date: Sat, 26 Sep 2015 09:45:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <56051D2B.5040802@samsung.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:Ti8VNlvLsIh3aFop1WeJpYlxyZt3+xcrARVu2dfa+BiSc6JX3vG ndev4OdDpt2fDSmerpRG8AaejOSJEBen7YSX+fdG+goiAn5f4V1MFWt6xTnoWsQiJ7FjAYV ZQMnMhS8+L/1ZHkYdoDzUOzqUxbfYXYPKQ016MJdkOhPLsIU+qrsubCR8nj2+For+/NYBmn SnXUOtXwfqMZSRHNoXMOA== X-UI-Out-Filterresults: notjunk:1;V01:K0:eUaK6cFi2Rk=:5qUJVL1i6re+JQxiu6vEeO SiRFyxZQXkhvsZ7OcdeG98x+e1rHrb38nJwaECFPFKam6vRSe0jJ3BZxZ7SWCm+v0V5O1UMK6 3w5mR221iwX1Q2GoLhMFOJkhXATWgYPPMgDnKBBpz9HZ3ZTXZP1Er0LSHrU4NBqPl3m6X+8FI 3/8Dw0bUG94yAe12TEA+g785ufVDFBBDpAzn6fOSEEK4EG82m5ArajqBJkjzb1FXPGIoB1VE3 D0rmpkTpQKzKs3fKDFEWhFxreAjcgDHoXmeX9hueYMvi1fAaPNDuPuZ65h1qju/8GJhBTsQ9g gHe7CYbr3Vm6TT/ddBfz9oRc+LXNcWcRxo0Xj9Ed4wLxYAyxHMyWsWSRwOwv35q7Zgj/YBVI8 LNMynx3Sq1EUcYOK8G+nFtiR4FcWSkhlgvRYh5wqeuxAtiO+xMhgNlj7xO1ZMh951n9Z3XtSV imIl7RQ4yOZP1tJJMzysVUicUA4s5pVMQFI1kEQE2ZgM2F8JLRdv9chjYxeRZYXbZBdBTLqWH FMzGg3RZ9q17N+FUnyYiMVx11L/ZIXvGGzADH536KadrA1wAJQyz9Hb/EOPxNsZfXyoRgeUUG KUU750ojzMF8ADmKI9HCUgLZjHCCPeWgfd2kyiq6Wht0+GxUTIoZ6pHhs/5pXo38snQ7e/DAH KVMuC1h/vER1oW9v/OTpTP4SQBSrlPXcY2GDxvEXhrDbABEiD64nIqSPU6fqPXJ78US7gxEgc RtgmzJfYsqohCG3wsMGyeraYllRHEDxqEEveUA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Generally I want to catch all assignments of signed function result to unsigned var. Such a static source code analysis will be useful to some degree. > In this script I have implemented it this way: > 1. Look for all assignments 'unsigned = signed' (rs rule). > 2. Check if signed from rs rule looks as a function call. I recommend to reconsider a few implementation details because I have got the impression that this check sequence is inappropriate. > Is there better way to do it? I suggest to fix expression weaknesses and a design mistake in this SmPL approach. I guess that you want to determine functions with a signed return type first before corresponding variable assignments will be checked further. * Would you like to collect function names for this purpose by a general analysis of more source files? (How do you think about to store them in a dedicated database?) * Which couple of function calls will be interesting for you? * Should the search approach take also recursively included files into account? Regards, Markus