From patchwork Sun Feb 11 15:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniil Dulov X-Patchwork-Id: 199465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1967341dyd; Sun, 11 Feb 2024 07:07:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4AVAIjD0OxLSYLQdnyqBth3zDdppsWAZOt6j9hN8eSqdzUYC2QqKrK1gqazmIRfLB1VOj X-Received: by 2002:a05:651c:b28:b0:2d0:f8af:9b48 with SMTP id b40-20020a05651c0b2800b002d0f8af9b48mr392103ljr.35.1707664055805; Sun, 11 Feb 2024 07:07:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664055; cv=pass; d=google.com; s=arc-20160816; b=quGJEXh8gm/YBqtZAVgyRmEpwvzeMWzcncnBXRGCKU5xvC8xwZHti8Vr1P0SoCOHCA U3QtQu5+bDQ2IDPub3TyQ7lgDHB/mNTdDAxbgbft9HaWXxPgaeWQDjq+Opn0ojUumUGT jQEAA79Gxa4iIKuUWO4W/2GD7WFTSq1gY3hZxQuet/a1R7DpK95WEvNLrxCPhIvdphNJ czPTMMjEZ9c3IoggDnf8xqutgVtd9uUvgxTyBDnh9iIvE2BQV1/BKn0nTOTkOZuok1u8 L+0/Y3GMGfxFF7/3jo3h5x1JCKLh8RtVnDJ2C7JBV0F6ZCmcaq2kQXIQsCPYBO2SimX2 j5Bg== 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:message-id:date:subject:cc:to :from; bh=tDMit1pz8tQj5s/fbqvlEovbkwiYoAQ9sM7yRhKLLa4=; fh=qTzHWFYmVrhxlKY3WPR6b01EPhbAV4fXsXT4QoU4YQQ=; b=0XkvKtH3F0U6tHuZypXiRy6SNLJXt+/0Paiaw01MX1C9RYLOGvR+hKeWnVXmNQ4xMJ V+Rc+g3qwUGPibGil7FbEWXSm/q+DDe+8eJl/FHZFWYJPBc62a2JlTqQ+7/2b22f3bu+ AxG82j78w1hnkia0Jgpg1xIkvAZb6vb6Ep+3uwMol70mp1vUQTScQjXK/lKN5khHZvM9 aYwZM5g7Y+pEWdLcP5lPACZcMdfvDZ/v3rW0lG3/QkQT3UfdLjSL7Bhl7IstKHdxtla5 qWTGxlFTNucBhJl5hl3nZq2rJglsfFfJxovYs4fyv7K59jnkYo/a953Ebh1dJzVVXIuk b1uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60813-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60813-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCWtKt6K1P99YUywYUJ4nQSr5YpMi1R8zGIg+Gm6n5JMnOoPDJIuPJkqtxibDIOXujoDNI62rNh5i/80gu9VYqCCDZbWOw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dc12-20020a170906c7cc00b00a37adf06a45si2867565ejb.258.2024.02.11.07.07.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:07:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60813-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60813-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60813-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru 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 674E91F21358 for ; Sun, 11 Feb 2024 15:07:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F1C25B689; Sun, 11 Feb 2024 15:07:19 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (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 87E8738DCC; Sun, 11 Feb 2024 15:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664037; cv=none; b=XBFBqI8xbEL3uKsg+pqey7zHk2sfin4RnW9szz7HvgtzHtIyvaT8Cxs08Whozi7YPT/K41T4Lo5YYK9gzM/EPMFNRmLFcfVSbgHanlElqjtL8z5AsTZGElfLovTRn+E9HPV/6lCRCCoiybxtcPFKdMT3TYqbsU67LqxE0MfxEgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664037; c=relaxed/simple; bh=tYjF23hS3kCuiZrPyeo90mjXDnz1Ql+YsvWXtiBdYuI=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jTBWRgY0iue9BFb+LUSpbUgRVYvBrPIa9QO9d2wgNFaEUDv4KdJ9GJ8ANxdF0fPyYoMCGJDGZi8fh9CARTAU085MD0xow0XRN6tjya919n1kqTW/UuB1T/EweFL/uDBRm9HXt/bN6vfkspJTlZCW4aOfV1TB3OxK4M16OLFCnmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Hans Verkuil CC: Daniil Dulov , Mauro Carvalho Chehab , Greg Kroah-Hartman , , , Subject: [PATCH] media: go7007: add check of return value of go7007_read_addr() Date: Sun, 11 Feb 2024 07:07:05 -0800 Message-ID: <20240211150705.3703-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EXCH-2016-02.aladdin.ru (192.168.1.102) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790615544691026201 X-GMAIL-MSGID: 1790615544691026201 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 --- 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 eeb85981e02b..762c13e49bfa 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;