Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1649584lqp; Mon, 15 Apr 2024 12:36:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjXvmNfBn874eIDYbNeL/3wDBZmwZ8RC5Ba4l3lkuDkKUOH4N6po5kXA2LEwirsG6bBGs/4+dsbpvKhLKduzX7++XLKquWjdPvNZfb4Q== X-Google-Smtp-Source: AGHT+IErDdJnST+MYhxCJfQPz6se/71FFwXKr8oBzvJVvxrWp922xQ8F1N02ycopBuLkpbGk8Gmm X-Received: by 2002:a50:cd9c:0:b0:56e:2daf:1edf with SMTP id p28-20020a50cd9c000000b0056e2daf1edfmr405036edi.21.1713209780155; Mon, 15 Apr 2024 12:36:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713209780; cv=pass; d=google.com; s=arc-20160816; b=NWphYUy6arzy72ahEqNNgr/w1Xg7jrxR+kIohRgbIJkiNDx6sPzHNYRT1torky3vr9 vOM5TaztLPK+6ll9pMZ2bQYxFRlJrvq/ap7/AH+8b02gVmKGiJXclniRXHZiiKRpGyHp hmL2wBuk384njbuWTpIMV82swLnAYuq717j5b9YO0AGVP5xyCXZPhQQEYJISmcD5jsiU lIL1+6k2d9vXkSMwvpEo3VWHzUMvHD+8+3nmV+bU3uRh5S2jud1b4rAzoJ34z1TwldDm Etk8wIVJ1ejxrxpM/A++Fqg1moTfMks+YO22w+Th1Ws4TgDE51C+r5/HL4CNJobx+Lw8 77Fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=w+qS5Z4vkKN1UceEhIkP1myjPLSe7r+1w4SAg1mZwEM=; fh=c6EjCMqFinq3lkZKV/xG6QWZWOZymYwDXe6KHPyXg4A=; b=pVyGANVSWqsxdFGjW9P1UoWzHNrMFl6GEDhXuTbgc6d48Swmtabt/8cJ7Uxzdfn1mk 5u1JXLsVCEa8M/DcunGuMb56zPdcfuECVwlOG7FGBEV+qy10XHcWkz1BUbtfpWDSw0F2 zI2PIs2tjA8E4WOZNPqKotU1WN9A/QXofSPpnW56nMNLJkl4DDnEkzlvRAfOJI3gYcG6 7DQ/XLLmkw/nw0st9guIGznxS5TwLj/6d1WB+dc+PHvCcP7aRsIM/83GlsAMIPKBwqQQ 3Rt7Rl+CieoqSjsYxBlMxuyqWhWY9Hok1sz7QpVPaaasJ9S/nxmM0X1LdQpPHeaaAnr3 We6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ekCQS+or; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145782-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145782-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v16-20020a509550000000b0056e219b4d29si4822634eda.679.2024.04.15.12.36.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145782-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ekCQS+or; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145782-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145782-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 DE5331F23C4D for ; Mon, 15 Apr 2024 19:36:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9819156655; Mon, 15 Apr 2024 19:34:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ekCQS+or" Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (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 05C1215625E for ; Mon, 15 Apr 2024 19:34:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209670; cv=none; b=U4sGnOuL7t7UP1biqnDQzab1EduJk5XM4V81S97Qf6LXRWHMOCAge38i2nwHOSnmh/1jd5ZDIIRZV2ik5EcJ9ZLu1kDJNoI34+/OYkTvZxOXhwlOA93B6erfDtTEEgO2eDyGKz6mbEEhIsAqQQvm/jrPZnEJy1FMciM8gHGVNsk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209670; c=relaxed/simple; bh=nJaDXaC2UVv5JFYI9MrsyQjDUNAmDoZ6Ny+NoEoYLTc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CG/b0TYLJMN0rSpco6Xiiy7WLhHlwjNv5KNWANkvAB69mMjtFM4PLYbQ08TNJ9h5vucVSnFjkzm6ZghzB+jKACs4drR0dhE17HtVUKhBF3BQo8HnSMFbZlFG+HtIE9jU9RY+oeBwYSMwEDOPAh4EnkUVpUTVRiV99Q+nZEJhOPg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ekCQS+or; arc=none smtp.client-ip=209.85.167.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3c7150cff81so243994b6e.2 for ; Mon, 15 Apr 2024 12:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209668; x=1713814468; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=w+qS5Z4vkKN1UceEhIkP1myjPLSe7r+1w4SAg1mZwEM=; b=ekCQS+or2wkAbKGn4PNwB6LXkb8bPeivno6eqgraR/SenJuMd+oqaAeKu4Gdxm4GrM xYe973uYC0yliHeHbE4sNDl0hEEUOTYfDCEDDyQd6jBd8xzVbntSawRQCJ09lSBmn7vZ 3qiNR6TiSZZpLM+C2+gEetvfvU0KBX9W4ugMg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713209668; x=1713814468; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w+qS5Z4vkKN1UceEhIkP1myjPLSe7r+1w4SAg1mZwEM=; b=ZMwTn0GDBDKP+B7QwgItYS07BYBAuqG6wft1/AKxmJAijO7kRDcrv5TRYYhcTLKnsu 4gMLdHd5whM69o5poJIi8Y3fM5/u6ATqPJcT8hNdXOJyS5jT71WdthmYKGg9lwGCYwYk j6YnHXOE70Womluk96bZxHhavuN3Be+qQ7PBOT5a1NxdFefCYAHYAvKfVnFSBdmn9Wur 4eHZgpnsXt2prl1Oy3ZjoH0HNz2Bda6llxDxUEYHZSO+G/HOXvyYj4UAOaseELAse3M+ C+KavSMo7iqAoq4tt34JoRIO1F58FUjj/4X7BD0pmfaSi31VOVlXGYZtviK7zH3Dp98i gNnA== X-Forwarded-Encrypted: i=1; AJvYcCWUEQT63YASHSJBNctCHubxFVmfydXUYjZphM7hIsCMAo7fZ44AR5L9vdOpsAce4oOhkFGzk+fPBZHBCbn6I/9/KXOzB2zFS0bovLKS X-Gm-Message-State: AOJu0Yw5gmHhh4BDfijS2ZQAorMh56khQBt/uYhbif8NlXqf9fv8xjPl 1c8oXooJ1YMnQpPy/HwtA78sJU9LCpApHKNFec+WCZPCWXs55GORM9ObYL76fg== X-Received: by 2002:a05:6808:4084:b0:3c5:f5a0:3b40 with SMTP id db4-20020a056808408400b003c5f5a03b40mr11232302oib.58.1713209668180; Mon, 15 Apr 2024 12:34:28 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id s26-20020ae9f71a000000b0078d3b54eb76sm6718055qkg.78.2024.04.15.12.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:34:27 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 19:34:18 +0000 Subject: [PATCH 01/35] media: pci: mgb4: Refactor struct resources 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="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240415-fix-cocci-v1-1-477afb23728b@chromium.org> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> In-Reply-To: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> To: 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, Ricardo Ribalda X-Mailer: b4 0.12.4 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; -- 2.44.0.683.g7961c838ac-goog