Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp124625rdb; Wed, 20 Dec 2023 07:55:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjBiTpGywAelLqR2E7EUUHtiRQ7rYBYcTIyzA083XOA2+ZzFyqiVLLI6k+L61Kw08zJISq X-Received: by 2002:ae9:e40f:0:b0:77f:2ee7:3eb with SMTP id q15-20020ae9e40f000000b0077f2ee703ebmr21881660qkc.128.1703087707692; Wed, 20 Dec 2023 07:55:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703087707; cv=none; d=google.com; s=arc-20160816; b=Rtfsa99LSlc5EVEUBUP48L0VyaoZu2wBak7djVpGPH41+pMUfmXue0VZn1Ok4RQY0+ rjS9Q2a6W1cQpEtUaRtPKNJEtSBmCsNL5CucFGiE6T0Cm75ppDMS7RC+PAj+6P/dQK5Q 1dSr0GYy0U1h/Qyxes0FCjIVdJU739weXsog6Qt4ySG/7ovDaie8R9F+jFrbX2Ynqq1y bF4TXzThbu+xyTk51kB3E3Ydnqgl7nKA8sCMufugRnb8J4LOcSNUyhOfp0DEwzYa/yiv F6C0dnw2UMr4HV8t+fiZZgVNYvDR6olQBhERTkYG6vn4X22ahAEL7z3vSG98Yo6zgaWj YK5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=+l0tLVDfDh4SPnK2uUTCtnj0kN9dJ+v1Jy4DQqLs9Ms=; fh=84x5k+UxKWtn9utONVmTCwEaeXEDBZb5aQPEIueE9UU=; b=hOHILJHZ5wk24EjE4TLcBVST2fy4Z8VNW01ou7G6AS8l9vV+nwa/Rbsata1Xk1CO+a S5OqksCYkLM9FD5ZXyyPen1LwGd+QYoBNpGZbzZB2ohRiw583+jN7bQXt4MYWbVbA1wa 1H4aiqhE7DYOKdroSPLFZs9+76w8iPJovwcK27GtawCZ22i3UGixKVNIhDBXQdWl6om5 V3uurTNJLkpjDaV5Hb2j/oW6GO7QascLigJnjQNWckVw5megTFcUnazq/oatmUDLkkKQ 2bmS+2YcAE4jxetKM/lNpSCxNEtvuG66WF571LGEyD6LocqTZley/IXW2gOrprzNDUlN zjvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m21-20020a05620a24d500b0077f60bceed5si23205qkn.351.2023.12.20.07.55.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:55:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-7210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7210-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 72BD51C20F56 for ; Wed, 20 Dec 2023 15:55:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E30E4652C; Wed, 20 Dec 2023 15:54:16 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 835C046520; Wed, 20 Dec 2023 15:54:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="394718101" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="394718101" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 07:54:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="867014290" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="867014290" Received: from smile.fi.intel.com ([10.237.72.54]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 07:54:11 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rFytb-00000007aqH-45CW; Wed, 20 Dec 2023 17:54:07 +0200 Date: Wed, 20 Dec 2023 17:54:07 +0200 From: Andy Shevchenko To: Hugo Villeneuve Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve Subject: Re: [PATCH 13/18] serial: sc16is7xx: use in_range() for DT properties bound checks Message-ID: References: <20231219171903.3530985-1-hugo@hugovil.com> <20231219171903.3530985-14-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231219171903.3530985-14-hugo@hugovil.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Dec 19, 2023 at 12:18:57PM -0500, Hugo Villeneuve wrote: > From: Hugo Villeneuve > > Improve code readability and efficiency by using in_range() when checking > device tree properties bound. ... > count = device_property_count_u32(dev, "irda-mode-ports"); > - if (count < 0 || count > SC16IS7XX_MAX_PORTS) > + if (!in_range(count, 0, SC16IS7XX_MAX_PORTS + 1)) > return; Okay, looking at this, it becomes uglier than initial code, means my suggestion was not good. Please, drop this patch. -- With Best Regards, Andy Shevchenko