Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2588133lqp; Mon, 25 Mar 2024 03:42:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX/E40hp62+Yll5ucPNBnz+s0SLubLTvdDBxyYguAHsF+bFncnCA0gPiBkqR5v65sRR7zdfW+K7sVuGWZ4IEL/bdSMHJLrZzzrYT/6DDw== X-Google-Smtp-Source: AGHT+IGabhVkogopJZf7/J2hfDxhL+m5g5DWHSl0PPA3kTKwF7xmHPd9+XAXYqtQC9VtHGIJPoIc X-Received: by 2002:a05:6a20:3d8a:b0:1a3:579f:2c5c with SMTP id s10-20020a056a203d8a00b001a3579f2c5cmr6606806pzi.53.1711363341652; Mon, 25 Mar 2024 03:42:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711363341; cv=pass; d=google.com; s=arc-20160816; b=biMYtIoYFiSCU49Z/x/w2NQF+iGuWVT9ODm2kXgmlgHg/nNygvLsMgydbDKpdEgKRJ E0D3+88xH5REMuLlYztj7jaC12zbW5g/55VvbLB1b/Y0+DtWXvLyz20k51zAjoLnhoAb Jcjv7+OqWVu3PTjVjibjVftUfZUbBgOvFaIxd/qOIRVqK0V9SvtrkeiZkcORTPTLfm6g yvNacET8KIcFE+hmeRgf3c8+bfl2n30ztYsHiOUcEUvOv2xHtDurIm5zSKWtpjpcuPd6 YjA7Z74y7mIH9jbVYBQvBC72VTgpBVL9MY9JJS3dsgzK66JkqwBCbfFMMDl1pVyC9m32 zz+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XtZSnU8XF6Ahf4ki9Tc9DMmWL7GOqdCq0Tc4+M4HSCU=; fh=4yftrWz4Cye0AGLnP1Q5VYayz020Nvtkc3evrRIWKzY=; b=ZRVllgQC90qtkP6d1a9iO8eLx4Jl4j/Rs4nYxcxtzmg4ywJ7wTdrXuvlATuKiYtJHS PfYigNNB682W+WId67OP6k4OJrt8DnfNjmNG49RE3gdw7yt+k222CgOfzZ6hArjUO2j8 4fkywCImAo6/GIMBf9NAJMEaazTOIfW7bjFKenHXV7xB+UotKkz6gNsEm5R5f+9RcLd2 YO/v24nQhkwgQwHY9aRgA8tBHzX3oVFErTI9/h+Hyb3XqqAkP7dRveFe2S+e8g9/Rlzu 4AV89alW54Hcom6+VpPP+qDJ6TsVeUUGyeX/PqN4HUmuKYeoeiHYB3qP1of1CQN5pk5n undw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nMYdwaI9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cd15-20020a056a00420f00b006eaaaf5e0a9si2023124pfb.93.2024.03.25.03.42.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:42:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nMYdwaI9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4F0EAB3ADEF for ; Mon, 25 Mar 2024 08:57:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F6AF3B8E74; Mon, 25 Mar 2024 03:33:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nMYdwaI9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5F88517C653; Sun, 24 Mar 2024 23:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323779; cv=none; b=GLDqvIZ/0xfEHNnFBFIRj6PCqvEDErmqryf2+P5KA+9WfO4b6d3DfLEnWrkKZaWnfFWiQpLVJEgGlMeDMJUnyH6wbM+2cLLWrEWevnYenC7FnLTqSXZN2LAU3Bk1OlmQtDL/gYREGFQccVAVXfy6zB08Kt+Hr26/t8iLEa3U4o8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323779; c=relaxed/simple; bh=BApVoZr1HWgG77uIAlP5say5xUHr6e9CzMP/GXvg8hE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qsSJyXSlp1tbSZ5zSsnPeLIChn+R1KKyyqPlDcixvf89y/g4IoC4RydbJviM6KHRdANhMVti07OXK4SbDYfJnI5ozag+eYLbBKz1x4mKqDFaSxCOxOd1mX5MGqfsssbl0W4IZ/mUJV8gzerDtrHECPzrb6C+jrGQt3DzKHzvcWc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nMYdwaI9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF61C43399; Sun, 24 Mar 2024 23:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323779; bh=BApVoZr1HWgG77uIAlP5say5xUHr6e9CzMP/GXvg8hE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMYdwaI9LOMBNowz1d71bpQtqklYryH6SoeM5EgIz7/XlT4BKRLUJsZluIrOcAA83 J64/gR6w53VWxTWcp5vYxnfSAydUHCsOlHYoPY/8C2gXGt9ttUk6wLf4IeapXfqWQd oKtUCFKFSUOeon/gyMZlzMMSWvh6lfQma/+8FkvWk9fFJJwI/e/42bSdH3qUwHcsKL N7WvO+8cpBioSy7Kff1qmhO2W4p4l4QKbeuRIM9z3GZh+jJkTa8Mf6Pm4cSvxwW2Dg JD5Bp9YCRaO3KPcHY2+F6zLIPCexcGlot9Zy2AN8iscA7IPHpgaYxfoBlMx/37XTW9 nO407c688Cs7Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniil Dulov , Hans Verkuil , Sasha Levin Subject: [PATCH 5.10 155/238] media: go7007: add check of return value of go7007_read_addr() Date: Sun, 24 Mar 2024 19:39:03 -0400 Message-ID: <20240324234027.1354210-156-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Daniil Dulov [ Upstream commit 0b70530ee740861f4776ff724fcc25023df1799a ] If go7007_read_addr() returns error channel is not assigned a value. In this case go to allocfail. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 866b8695d67e ("Staging: add the go7007 video driver") Signed-off-by: Daniil Dulov Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/go7007/go7007-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c index eeb85981e02b6..762c13e49bfa5 100644 --- a/drivers/media/usb/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c @@ -1201,7 +1201,9 @@ static int go7007_usb_probe(struct usb_interface *intf, u16 channel; /* read channel number from GPIO[1:0] */ - go7007_read_addr(go, 0x3c81, &channel); + if (go7007_read_addr(go, 0x3c81, &channel)) + goto allocfail; + channel &= 0x3; go->board_id = GO7007_BOARDID_ADLINK_MPG24; usb->board = board = &board_adlink_mpg24; -- 2.43.0