Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1994665lqp; Tue, 16 Apr 2024 04:30:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfhGiCBHiI61ACn9Qoj9kzJJB6bZ2nabPomOL0xInEZFfFTyeD3KeZ6c4urooR2+U+36TYwwSxXvenk61z+uENWhR9JmKYL1TaO1wybQ== X-Google-Smtp-Source: AGHT+IENbThiSAg6q9BIQivb0fDwUhrkLHyWOjlbsKsB5+G8GE+AmkZXpFSj+KjQQqOGMu0vJlxo X-Received: by 2002:a17:907:a0b:b0:a51:ddc6:f9c0 with SMTP id bb11-20020a1709070a0b00b00a51ddc6f9c0mr8834045ejc.45.1713267034576; Tue, 16 Apr 2024 04:30:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713267034; cv=pass; d=google.com; s=arc-20160816; b=Img/VEtwyIgCT9p9v35GsxXH+XNGjdMLLDgZymjrj/MmwNDC0/Ges4h7Q5kk4KRgK1 FZ1DCUKAgWuD289qJH2QwSX1URGUzS//i4oRPJ//SAvPvI9VADN6e5Ge6KggLsPHKmPq mO9eyCxljoEwc+I3XQ7UalBD5utpeeafZV6bDoEF5RmHPqLCskjNPj1umFRB6BSojWlt Rebe7N9Xw56IPV0AuhGUN4+8o6f+SlahG6w7i4xXGpEYp2BcKT9VPJNEdannnQL5UZxc t3SLMruGfuO4SPTIcrNXyA3CFU+xDpJjLmEH0htDvHyoG122mDjHesb+4NJQopsd2uZX TCUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=I0TwC4jTFZQFcvPHoRsQ3cnPpheXhD0mrnYwFfdBLMw=; fh=//gwFLmaZvZbh4/VPNyWp2u24IWweaV1HIpECVrlr5c=; b=Yeq2Dk3DZCCNt/QpsDhqO8FqnZpxmdH/qKtmrcOpdTAMa9L0u9nhET26WFFy9fXT/Y /tkcu97nblNcEJUqr0yRw9vir9E4632zZnuiomuQA4YbMET4xnDG/XzI6cU8XwWehjv/ 9+qW77VM/qz9z2jTgcvZH+f55u8EEuPNDR4slqPplBHn9tJSXIdlOQbjdGpZ+smXBAXO jdcjFdC2t+9dBmhAw/7l1RWEvhgDSrI/G3RLHAfRhr33RBser5+nV0nI8ewIvt5vgjpi NQeX33g8IKK6POHWQI4DvzP3Rc19OBPTX1sCykpzYkyDPhnx3NFeQ23V/Ds7i2qJX7hk NTxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gpxsee.org); spf=pass (google.com: domain of linux-kernel+bounces-146705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146705-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id he40-20020a1709073da800b00a524394aab8si4124472ejc.599.2024.04.16.04.30.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 04:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gpxsee.org); spf=pass (google.com: domain of linux-kernel+bounces-146705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146705-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4BFBD1F21E7D for ; Tue, 16 Apr 2024 11:30:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED308129A68; Tue, 16 Apr 2024 11:30:22 +0000 (UTC) Received: from mx.gpxsee.org (mx.gpxsee.org [37.205.14.76]) (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 292D2128377; Tue, 16 Apr 2024 11:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=37.205.14.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713267022; cv=none; b=IuCXSrQUk80KNw43jFOPEeGK0I+rFzCkyopjEuko9j4P9PDoITrcFNa47RZpdta8GJ7ayQvtBggd0Ny3H6lDUMtbaAn2xcXfONG45/IKtjHOXQqUnHm7l2X4/9cbcVFLAqBMf5fepXiDPoZ9h/10hnxRatla9KtVJY4qxbIHsaY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713267022; c=relaxed/simple; bh=hFklNXAFTh7lsJu6P5YapMDLqrxmPeSouEGbwGP1ixQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=m9M+QI56RbQPaxruY5yKh+nz3eHEidniZ49VU2RW6u3PlgPXbg1I1jNI1yCoFh8lUkj8ZnZDj6ZiWK3Fi8EJqrZStkEEqTdBEQ/6l5lnpUpaKi56CZbgl9j8w/JxAJ7HzW2wfyVEZCQg7Q+VdwJ/mLwgTJcVgRkRrmKmF9RdytA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gpxsee.org; spf=pass smtp.mailfrom=gpxsee.org; arc=none smtp.client-ip=37.205.14.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gpxsee.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gpxsee.org Received: from [192.168.4.14] (unknown [62.77.71.229]) by mx.gpxsee.org (Postfix) with ESMTPSA id 9583E3B254; Tue, 16 Apr 2024 13:30:06 +0200 (CEST) Message-ID: <0bea915c-ddad-44b6-ade1-187307da504b@gpxsee.org> Date: Tue, 16 Apr 2024 13:30:02 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 01/35] media: pci: mgb4: Refactor struct resources To: Ricardo Ribalda , Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hans Verkuil , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Pavel Machek Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> <20240415-fix-cocci-v1-1-477afb23728b@chromium.org> Content-Language: en-US From: =?UTF-8?Q?Martin_T=C5=AFma?= In-Reply-To: <20240415-fix-cocci-v1-1-477afb23728b@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 15. 04. 24 21:34, Ricardo Ribalda wrote: > The struct resource end field is inclusive not exclusive, this is, the > size is (end - start) +1. > > Update the definitions and use the generic resource_size() function. > > Fixes cocci check: > drivers/media/pci/mgb4/mgb4_regs.c:13:22-25: WARNING: Suspicious code. resource_size is maybe missing with res > > Signed-off-by: Ricardo Ribalda > --- > drivers/media/pci/mgb4/mgb4_core.c | 4 ++-- > drivers/media/pci/mgb4/mgb4_regs.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c > index 9bcf10a77fd3..60498a5abebf 100644 > --- a/drivers/media/pci/mgb4/mgb4_core.c > +++ b/drivers/media/pci/mgb4/mgb4_core.c > @@ -493,13 +493,13 @@ static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id) > struct mgb4_dev *mgbdev; > struct resource video = { > .start = 0x0, > - .end = 0x100, > + .end = 0xff, > .flags = IORESOURCE_MEM, > .name = "mgb4-video", > }; > struct resource cmt = { > .start = 0x1000, > - .end = 0x1800, > + .end = 0x17ff, > .flags = IORESOURCE_MEM, > .name = "mgb4-cmt", > }; > diff --git a/drivers/media/pci/mgb4/mgb4_regs.c b/drivers/media/pci/mgb4/mgb4_regs.c > index 53d4e4503a74..31befd722d72 100644 > --- a/drivers/media/pci/mgb4/mgb4_regs.c > +++ b/drivers/media/pci/mgb4/mgb4_regs.c > @@ -10,7 +10,7 @@ > int mgb4_regs_map(struct resource *res, struct mgb4_regs *regs) > { > regs->mapbase = res->start; > - regs->mapsize = res->end - res->start; > + regs->mapsize = resource_size(res); > > if (!request_mem_region(regs->mapbase, regs->mapsize, res->name)) > return -EINVAL; > Reviewed-by: Martin Tůma