From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CA6B3DDDCD for ; Tue, 24 Mar 2026 16:35:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774370158; cv=none; b=Cnhni8ZieCat8npfMX7GPJP4Pwnu7hCjzSl3nZxAZ8qKCTK6azWP5+p5s/hGQgkmj8iHSZGReWmozDHhGh+CEVdyR0zodFZw1wFsfFQL2BhzO8jg1oyu3Cq3duRWbXg7mqEOjpBk21YxO0QZGOtK6SW10BnT1VMvB9oYZbJwzPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774370158; c=relaxed/simple; bh=lsnjJ8/ec8jiFLpe2KNzg98GKRz0z6bdgCeuwg06JLU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KgxbFDRjK6sB5bYNZAdB6TlKeICxSwzn8O07yfsXD1X3GPN4KgaghpMp5W7HCoJePkSWCssMBDCijuGPxVAU1lNoVekSh9iwx9xc2R1bR0lHlVWUXQDuBRLFeeT74rcwq9T/FVHQ8ywECkyj/na58Kfvpol0XdW5QR66NoEtDDU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JE/atEqP; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JE/atEqP" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2b062069f80so28005335ad.0 for ; Tue, 24 Mar 2026 09:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1774370157; x=1774974957; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=17gapahkvrjgJAf0ibu+DTJZewyuZg/tunMddSRxAlo=; b=JE/atEqPLm7nAngZZA7ri2S3jmia83ts8pHsvm+y5vy9mk0K+nzHX39ZhL3apz6SYM r3yhj8jZFP/F9Hmy4UAnashE8tlwb4oQbrzfoBLrw5cggfBCd7jx65eqB7gIhEMWpHNZ bEErE/lgm4OX1ZSqMz2tKf+Egzb4Yay1/D03bPoRq6jPXCWlz19aQ0S73srwUPbF+Vzr dzOQN0BenVYSzewCanrK969RDpTkVYSgcGRLveE/Q5Aexmsi8shJwJrq++oTb/uDTdmm slIwNEqeMDnSMi2ybZqgE0Xv8XK275yc8Lt7NAoqICD8PWUJzTLBamWjKjSFSw4sJ7Wz VdwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774370157; x=1774974957; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=17gapahkvrjgJAf0ibu+DTJZewyuZg/tunMddSRxAlo=; b=hUhqYX2krNo3WhDiupVPxG4jNrGLtl4Q8XsxDopmlcBsOWo8Cz9AXj2F4SCs7cZuEG wxKpKm9gAgEt3fZcOnT3YIrQuwkt4TNsyIg9TP+/cY8UtWtSIDS6WUw5vXzajB8P6wPO Gx2RUVPG0wYXalr5CIevadKx50CPOLexxtBVKGqGFb704NegpoR6dKjNq/GVw0Nh3UT/ 363dGf8mQh5LT/C4GGzDp1A9rKU9vswrUPt60v5hRGH0KjW7w87lvF/zfjroJd8GUDTj 88ah9KqFG7b5Z+do1KVdjmUkU89hwGqaa2wiHp6YAtZCeXpRt+EDWvNZMZJb/bLDlAUD WldQ== X-Forwarded-Encrypted: i=1; AJvYcCWiugojTStWxcrzvYGkQ0O3GUN2bJZYOOYOwB7WtgRkXNLPfSy3UIzRaNiULTczKSj5KbBCZJhFDjrsChQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzCqEn+BCGdJLM7xbEIu2bknDYenqW6uYDXCMcjuB1WxQyeOQX4 oD0c/hWsGoirjypdldj7BhFfcTgspvZc9n5zR1PU3vDH1JrkWRi2ff7vNEqHcKFEBIef1sJsBhI GBtSO X-Gm-Gg: ATEYQzwen9QJ3/zHIyuFDqOLKrwH/iEnX2OuCCtksmxpR69MBew8692nZkfk2wWQnTg ioVrVK7sDzCxMOKdcaeRdneOLcmsaGpofbJ52YTS1p+e26HENIuxAGWSepUN6hWO+eqnfj+M2TO RVU1+yYyHucsRkggBLyKCx0A5r5u+YzfJlYSyac3fxCqjEBMCv4ynlf20+FNTljxu/zqV2gQ150 h4079RdUqjqAdXtI5RIex5iA4mMmX/70CZU8pOyznxJ1SZRPjngdgh2oOIgKBuNohW0CHPlIo/m qgbKS+/YyODINCRrQtY2nQ2VxaFyxbwuO6YGtJlxTXemRAMaGIj4EL/kGlSsGY6e+O0OhPsLXH8 3Gu1tY2D90GfZ2ScTmqet/ZGIhfl/YTZxxrKieUKNL2SaEZoi1KxKl9z1QM/L/0DVZR+pigNRdT 0x+i4PlCi6vyhboWKlV8aZgxq9zI8= X-Received: by 2002:a17:903:183:b0:2ae:44db:56ed with SMTP id d9443c01a7336-2b0b09f7066mr3054845ad.15.1774370156329; Tue, 24 Mar 2026 09:35:56 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:6416:274f:1546:52e1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0836b6dc8sm158960865ad.82.2026.03.24.09.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 09:35:51 -0700 (PDT) Date: Tue, 24 Mar 2026 10:35:48 -0600 From: Mathieu Poirier To: Anas Iqbal Cc: andersson@kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] remoteproc: use SIZE_MAX in rproc_u64_fit_in_size_t() Message-ID: References: <20260314110137.178981-1-mohd.abd.6602@gmail.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: <20260314110137.178981-1-mohd.abd.6602@gmail.com> On Sat, Mar 14, 2026 at 11:01:37AM +0000, Anas Iqbal wrote: > Smatch reports: > > drivers/remoteproc/remoteproc_elf_loader.c:221 > warn: always true condition '(val <= -1)' > > The helper function rproc_u64_fit_in_size_t() compares the value > against (size_t)-1, which is equivalent to SIZE_MAX but can confuse > static analysis tools and lead to the above warning. > > Replace (size_t)-1 with SIZE_MAX to make the intent explicit and > avoid the Smatch warning without changing the behavior. > > Signed-off-by: Anas Iqbal > --- > drivers/remoteproc/remoteproc_internal.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h > index 0cd09e67ac14..0a5e15744b1d 100644 > --- a/drivers/remoteproc/remoteproc_internal.h > +++ b/drivers/remoteproc/remoteproc_internal.h > @@ -218,7 +218,7 @@ bool rproc_u64_fit_in_size_t(u64 val) > if (sizeof(size_t) == sizeof(u64)) > return true; > > - return (val <= (size_t) -1); > + return val <= SIZE_MAX; Applied. Thanks, Mathieu > } > > #endif /* REMOTEPROC_INTERNAL_H */ > -- > 2.43.0 >