Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp424284pxa; Fri, 14 Aug 2020 07:54:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa2kU9c0FZrXbD9+1cpcy1XpuFsIT4I2EAMdr2WGdBYYMOUO/OrnInqOx/QnBQ95xIQ03a X-Received: by 2002:a17:906:1cd4:: with SMTP id i20mr2703012ejh.480.1597416868391; Fri, 14 Aug 2020 07:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597416868; cv=none; d=google.com; s=arc-20160816; b=zVcjhB3aoy7WgpctxE/CwAwxvfqBnSH/V5hpV6BtpHqejKZQ0VAunfDdaD8Z9HvzF/ MtMvjcbQjY9YH1brC4Cihxag4pdSVYSo77mbRse1s3JywUpjZsRleQb2M9tE1Lm3mgJi VH4zQuWYVhbewr9P4fXzb5UMY3UDocWPZkB/8D3MeUX4x1NvZpPmdoBX/VcmXL8Rbagr E7wtmHSUYUKfpjbo/ESZ7MAQ5nlkgV0ORI/NMaKsKIP06dxoelloKb5VW1my0jCUXdzg 0VmIFs07Tk5L6aQLPm2YX7zOFpbY0Im8edrYvrYy46pzrd1O3qeIjtvi0bs1N/+/Ic8V ADYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:from:references:cc:to:reply-to; bh=NO9eozMTpwGqng8nuxmq3yXenUdC5M4ZNaIM3MPApoc=; b=z6janu7KVgCBfQXmkUBjBF3IAbSoCW9wZW4TMKqxiEETdOLjemd1VJiOv8vzg2O/Mq tZ05kznyBBaUxVpmU4sVNGZ29T3wHTuWWYY3yo0u/ONpY4MEHo+Oxyngdbtvm/4pmj3s rxTb4QzAUwwG0bgChutr7443JJp/uHc72sI1QRZm3YcZEnx2/rEG7IW2pceGVtCEFk0u uR5r/BevZHiUXgWnqbQR5hA4FAdDvepps4xEegesW+r6XfrWgFBEaHGn+a9TtvvNwjQk vkPsfICRlwBQLq5S8klrGeVqYA25338vMx55pUpQkZSGc0h4mMF0wsQTjg9057Gfwj/d vAag== 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 gw21si5394345ejb.656.2020.08.14.07.54.05; Fri, 14 Aug 2020 07:54:28 -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 S1728740AbgHNOgk (ORCPT + 99 others); Fri, 14 Aug 2020 10:36:40 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:40165 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbgHNOgk (ORCPT ); Fri, 14 Aug 2020 10:36:40 -0400 Received: by mail-lf1-f65.google.com with SMTP id m15so4924225lfp.7; Fri, 14 Aug 2020 07:36:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:to:cc:references:from:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=NO9eozMTpwGqng8nuxmq3yXenUdC5M4ZNaIM3MPApoc=; b=t85Q/X6sQIH7iPEeoNPjxbmhF8lviLw1h/whYTjA25Py2pQxP1XX+uNpUx+6mBcZSd IqDfWZ2cQxnrkjTzk+Rr5Pwn+8/vbEi2DwwJaPgLx6Li13afPPmbOs5BCvDd05r9jdfg 4fXRp/f7irbcPsP2Z27+b0Cn+Gme0KYYylizRIbQ35P5g+7mQdRtz3NPELlj879XbsZm xZr8gN1w+3rb7bXnPHNs2Y19DEJplts+QZRvphu4TCjylaN3BuadyZv4L58Orzg//j9e UGzQzgRX2oRGp1m61rsN5GhucoL0jOIJqTkQoXMyfWq6NNYjlDHBC1OV+mTP9cB7EeXC hOOA== X-Gm-Message-State: AOAM533kuzzGW+2RnESjfgkPz4rOLAIw/rSfHpK6s2OPYJVncHjBPbC9 ZmhtXks43EqN9+Kz3VwCr2TabpMgxI4= X-Received: by 2002:a19:6b0e:: with SMTP id d14mr1370001lfa.103.1597415796370; Fri, 14 Aug 2020 07:36:36 -0700 (PDT) Received: from [10.68.32.147] (broadband-37-110-38-130.ip.moscow.rt.ru. [37.110.38.130]) by smtp.gmail.com with ESMTPSA id t12sm1242709lfe.43.2020.08.14.07.36.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Aug 2020 07:36:35 -0700 (PDT) Reply-To: efremov@linux.com To: Markus Elfring , Coccinelle Cc: Julia Lawall , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <8e76e81f-970b-b1f7-840d-10506dc3311a@linux.com> <48ffa436-6e73-88b2-07bc-89942f3c6d8e@web.de> From: Denis Efremov Autocrypt: addr=efremov@linux.com; keydata= mQINBFsJUXwBEADDnzbOGE/X5ZdHqpK/kNmR7AY39b/rR+2Wm/VbQHV+jpGk8ZL07iOWnVe1 ZInSp3Ze+scB4ZK+y48z0YDvKUU3L85Nb31UASB2bgWIV+8tmW4kV8a2PosqIc4wp4/Qa2A/ Ip6q+bWurxOOjyJkfzt51p6Th4FTUsuoxINKRMjHrs/0y5oEc7Wt/1qk2ljmnSocg3fMxo8+ y6IxmXt5tYvt+FfBqx/1XwXuOSd0WOku+/jscYmBPwyrLdk/pMSnnld6a2Fp1zxWIKz+4VJm QEIlCTe5SO3h5sozpXeWS916VwwCuf8oov6706yC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PDr08zgzXaZ2+QJjp44HSyzxgONmHAroFcqCFUlfAqUDO T30gV5bQ8BHqvfWyEhJT+CS3JJyP8BmmSgPa0Adlp6Do+pRsOO1YNNO78SYABhMi3fEa7X37 WxL31TrNCPnIauTgZtf/KCFQJpKaakC3ffEkPhyTjEl7oOE9xccNjccZraadi+2uHV0ULA1m ycHhb817A03n1I00QwLf2wOkckdqTqRbFFI/ik69hF9hemK/BmAHpShI+z1JsYT9cSs8D7wb aF/jQVy4URensgAPkgXsRiboqOj/rTz9F5mpd/gPU/IOUPFEMoo4TInt/+dEVECHioU3RRrW EahrGMfRngbdp/mKs9aBR56ECMfFFUPyI3VJsNbgpcIJjV/0N+JdJKQpJ/4uQ2zNm0wH/RU8 CRJvEwtKemX6fp/zLI36Gvz8zJIjSBIEqCb7vdgvWarksrhmi6/Jay5zRZ03+k6YwiqgX8t7 ANwvYa1h1dQ36OiTqm1cIxRCGl4wrypOVGx3OjCar7sBLD+NkwO4RaqFvdv0xuuy4x01VnOF Subject: Re: [PATCH] coccinelle: api: add sprintf() support to device_attr_show Message-ID: <0a9015b6-9037-59c5-31f2-cd2b32c86b50@linux.com> Date: Fri, 14 Aug 2020 17:36:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <48ffa436-6e73-88b2-07bc-89942f3c6d8e@web.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/14/20 3:30 PM, Markus Elfring wrote: >>> You propose to use a nested SmPL disjunction for desired adjustments. >>> I suggest to start a corresponding case distinction behind >>> the key word “return” instead of repeating it three times. >> >> It doesn't work. > > How do you think about to apply a SmPL rule variant like the following? > > @rp depends on patch@ > identifier show, dev, attr, buf; > constant str; > @@ > > ssize_t show(struct device *dev, struct device_attribute *attr, char *buf) > { > <... > return > ( > - snprintf > + sprintf > ( > buf, > - \(PAGE_SIZE\|PAGE_SIZE - 1\), > ( str > | > ( "%i"\|"%i\n"\|"%li"\|"%li\n"\|"%lli"\|"%lli\n"\| > "%d"\|"%d\n"\|"%ld"\|"%ld\n"\|"%lld"\|"%lld\n"\| > "%u"\|"%u\n"\|"%lu"\|"%lu\n"\|"%llu"\|"%llu\n"\| > "%x"\|"%x\n"\|"%lx"\|"%lx\n"\|"%llx"\|"%llx\n"\| > "%X"\|"%X\n"\|"%lX"\|"%lX\n"\|"%llX"\|"%llX\n"\| > "0x%x"\|"0x%x\n"\|"0x%lx"\|"0x%lx\n"\|"0x%llx"\|"0x%llx\n"\| > "0x%X"\|"0x%X\n"\|"0x%lX"\|"0x%lX\n"\|"0x%llX"\|"0x%llX\n"\| > "%02x\n"\|"%03x\n"\|"%04x\n"\|"%08x\n"\| > "%02X\n"\|"%03X\n"\|"%04X\n"\|"%08X\n"\| > "0x%02x\n"\|"0x%03x\n"\|"0x%04x\n"\|"0x%08x\n"\| > "0x%02X\n"\|"0x%03X\n"\|"0x%04X\n"\|"0x%08X\n"\| > "%zd"\|"%zd\n"\|"%zu"\|"%zu\n"\|"%zx"\|"%zx\n"\| > "%c"\|"%c\n"\|"%p"\|"%p\n"\|"%pU\n"\|"%pUl\n"\|"%hu\n" > ) , > ... > ) > ) > | > - snprintf > + scnprintf > (...) > ); > ...> > } > 3 levels of nested disjunctions makes this pattern completely unreadable and gives no comparable benefits. I don't think we should care much about number of characters in the kernel sources, gzip will do a better job anyway. Thanks, Denis