Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4354480ybg; Tue, 29 Oct 2019 06:01:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfS8dX1Hl4e6vpgVMspfeDb3ZpI4CN9D0LgAj225sL6jSB7UjBLvdaj+WjcF1TpP5eN9w2 X-Received: by 2002:a17:906:2961:: with SMTP id x1mr3109330ejd.91.1572354103081; Tue, 29 Oct 2019 06:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572354103; cv=none; d=google.com; s=arc-20160816; b=KcVLgNJWt17tMQqxbscGYNW1a2jI2kQdSYLzlZ8cVkve5qBCfSrpV04zFqBtpZq8rZ QFCnWvBVfwdBsV/3wc4nj+cWeo/7q0aBW54EJaDE3ePlPQGKAreeECg0pxM3L1EnOEM2 tFkDohdqr+cSzRsY8myar3dzjGPWUybVsBFChCaSxPkdhDW7QsihfpTxDJp/p6F6I1yz kyUvaA48AQpEL1uMnAdVk09CuEmkeIUsh9578ajxSfgwdRPJib8ysdrnkQWW7kCJTbl5 5uLS3k2ia24yVrrJ41GfXJjSr1cD4xyQKeK1nMyampuT1d/35NW6CyWrCLquUe5d8Y3C DJCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ekEQjLDbbm8ZMI/y+AQ/ISG2wMrHvsYf9NqMlkttQWw=; b=FGVkcSNziICc9Y2aTTp3CSa/Qk2OyUbsTqs/TfPKRCGACyzh4KC4RemDq5loSOepua ER5pZsYTQEB7/tDImtqkcEO8x/+P0q0OysnewoG5zhXNy6Gtt66IJ2CDnmXUyif/rviK EYuSo3vdXNc6UJYPde1XWu7GNq1cs3iusFMXk7vg34ob4W876GHtFts7gCtNWg/++B2/ Dzdbocqk74/4DLPFgusV/cnclcFFRiPhuxqg/17NJ81k4DCPYPt/x2m9yckcTMF4dPWU K486+66jk65AJQJ57IflZUNJd1Z7r29datSCBYIW+dgyM3jV8KcFpBjp2ceW60vcjqNM joFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=bekM1Zv1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cw1si8069401ejb.117.2019.10.29.06.01.14; Tue, 29 Oct 2019 06:01:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=bekM1Zv1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388170AbfJ2M5e (ORCPT + 99 others); Tue, 29 Oct 2019 08:57:34 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:39220 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388137AbfJ2M5a (ORCPT ); Tue, 29 Oct 2019 08:57:30 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9TCunl9081036; Tue, 29 Oct 2019 12:57:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=ekEQjLDbbm8ZMI/y+AQ/ISG2wMrHvsYf9NqMlkttQWw=; b=bekM1Zv1UT4/zMGEDvJLpyWrlkRCeKaYWzyeH882db96FgRw3l5qHyrPHjtnnV2Md2Kj xzkVMOjR+uvGAFTiVDbZ3AXSA729A6UpZQ4Adhx3TVrn0oXwKaLOwb2xqmO5if7dpA5+ GKaatmiYkTlTUe5SqbE4AfgweaA8umSNunaw6HL5Z2xMSwoD46JO7NJgR5TE0IBGMeJB Zqyv+KQRUPZEx38hF7osqf8AsW9sW8tYb6rbTBiTCaJSCRyWnjBX5wEl+sHUHGfPcC0B TTTIcB0B5G+MtNYQ9nltyPfElXvEoidbsticef+RipU8Gq3l+fqrOoOSU+H0gTlYR/Lz hw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2vvdju950a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Oct 2019 12:57:27 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9TChecX130593; Tue, 29 Oct 2019 12:55:27 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2vxh9y1ttw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Oct 2019 12:55:27 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x9TCtQmg011003; Tue, 29 Oct 2019 12:55:26 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Oct 2019 05:55:25 -0700 Date: Tue, 29 Oct 2019 15:55:19 +0300 From: Dan Carpenter To: Luc Van Oostenryck Cc: Rasmus Villemoes , Dan Carpenter , linux-sparse@vger.kernel.org, LKML Subject: Re: detecting misuse of of_get_property Message-ID: <20191029125519.GA1705@kadam> References: <20191029104917.GI1944@kadam> <20191029114750.a7inago2vd2o4lzl@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191029114750.a7inago2vd2o4lzl@ltop.local> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9424 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=997 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910290126 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9424 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910290126 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 29, 2019 at 12:47:50PM +0100, Luc Van Oostenryck wrote: > On Tue, Oct 29, 2019 at 01:50:58PM +0300, Dan Carpenter wrote: > > +static void match_of_get_property(const char *fn, struct expression *expr, void *unused) > > +{ > > + struct expression *left = expr->left; > > + struct symbol *type; > > + > > + type = get_type(left); > > + if (!type || type->type != SYM_PTR) > > + return; > > + type = get_base_type(type); > > + if (type_bits(type) == 8) > > + return; > > + if (type->type == SYM_RESTRICT) > > + return; > > Wouldn't this also silently accept assignments to any bitwise > type: __le32, __be16, ... ? It does, yes. I'm not sure how big of an issue that is... I always just throw a check together and test it before I decide if it's worth investing more time into it. regards, dan carpenter