Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2003080rdb; Sun, 11 Feb 2024 07:08:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjZMKOPQYSDUhgltBXy/AnHeu+Z8g2IcfOJsS6TT7KqEbdB0YZWGQGGVVg5/USR+nK6YC4 X-Received: by 2002:aa7:db54:0:b0:560:941:131b with SMTP id n20-20020aa7db54000000b005600941131bmr2543135edt.26.1707664097739; Sun, 11 Feb 2024 07:08:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664097; cv=pass; d=google.com; s=arc-20160816; b=z0ok6U99niRP2UmSZRFrJ0SyIwbK9gET/XuNMmNycG8pjTtFo6UawohHGFeHj4oT6u RKc73O+KQEjZEi+J3VDSuk1mM8Ix7tJfDk4mAyFftLnO4duMO2JGcVhYU5xnoOk5ob4n HM0QwjkfD52VozLqBUnDBmAISsxtrxnkvvqFxxGU6DLDqKzmXArp6EV+92LXap78WNKc Fv5JXWj3pgvYOZOhgNhj80BSpSTM8f2z2SqY2NSXtjPmP8w/f+R4uEFBIhRbO69CraLg wPV4cByGqEL1AInVFkSPWF9eiDWdxhgsyfOXMA8GgvRV92t+RI+WZISAfL7qKLfzVkMs 1tjw== 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=IlY1xXkKAoGp3Vs09q+voA6r6dQmLshqPP6a1Rz6ok0=; fh=d5LpALqYSV12uzWCh1enZ4qLwg7bUxos53Jko3LrIJo=; b=u5xfMpiUBSSBiuNl3rNPVF6bEZVPX2aWbkUrPYupaxWUu+9pOo17iGjuVvJ4kLEwRW UbbDr10OrM61K4LJ7yoqqiNnwqBntbEcr+QgUJ3B/sXN8CtjZ1OiIbFk33RN5Gkgc+K3 EqMXGVYDNn2uD4vismGg7+VSStmohGQ790ce3GC/kX1v7Vc+xH+xagAJuHj1jwcVoeyC Gb1EqNnjkHzNQN7oCBQB0pYfcUmsIqrOyJp5ixPsZPHxeGj/nvaLSVFelTp781LI/u3B xXP3/C++R8vDhDIzbQ8PQSVGFSl21BQ0KCF+LszCqkIhWCtNb+bZIfp4VFwPZSjtO1Q+ x8nA==; 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-60815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCXK/3xSqqccgXdpk8SkIw/4WjA9YEK/vrQmMjAyDiamC5KUYcQwk7yqNx7eZy+Q3DpjBR2XSLOHtoqojAU0Lb29EU6G6ApHO0YifbDPhQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c11-20020a05640227cb00b00561786c0363si1448103ede.118.2024.02.11.07.08.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:08:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60815-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=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60815-linux.lists.archive=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 7C1461F21624 for ; Sun, 11 Feb 2024 15:08:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F190F5B681; Sun, 11 Feb 2024 15:08:03 +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 7641C5B5D0; Sun, 11 Feb 2024 15:07:59 +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=1707664083; cv=none; b=maRjLFilESvV7KPn2ZYtvG3XwxERojgzP3EiEzRxDEsKNAn5nYXRTZr6nFSc+bldaOqJHyCTLP2CF3gxT6CqPoGaFHhxDw2/eo449mIZDv+X5E/11FFIMrebQfewRHiBrNrbbIoSl+8+icYsH+/lk8XYponEqJixd2Je4yt8EUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664083; c=relaxed/simple; bh=sueJpulddtDvnQgZUkdO21U1DNcg8cZRkMNzuFg+1AI=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=sWnCI2Hlz6JYLTjJan/NaFF25ik1SPm6nEqjKlRYUaHzruxowFQ/AknH5XFwiRodE+0EkmVGnkt1Irds5Ry6GeBPkUaCQT7+JLOQxc6KyOIpLPh3xVSA3AmjEHCvXuCiHk6CDrx7G6yYSBtLm314IgpcGKTV4sLPAYob1Jl+gZc= 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: Mauro Carvalho Chehab CC: Daniil Dulov , Hans Verkuil , Takahiro Adachi , Takeru Komoriya , , , Subject: [PATCH 17/17] media: upd64031a: Check return value of i2c_master_recv() Date: Sun, 11 Feb 2024 07:07:48 -0800 Message-ID: <20240211150749.3832-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-2016-04.aladdin.ru (192.168.1.104) To EXCH-2016-01.aladdin.ru (192.168.1.101) i2c_master_recv() may return an error, so add a check and return 0xff in case it is passed. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: add953cecba8 ("V4L/DVB (3665): Add new NEC uPD64031A and uPD64083 i2c drivers") Signed-off-by: Daniil Dulov --- drivers/media/i2c/upd64031a.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/upd64031a.c b/drivers/media/i2c/upd64031a.c index ef35c6574785..f51f86f30c73 100644 --- a/drivers/media/i2c/upd64031a.c +++ b/drivers/media/i2c/upd64031a.c @@ -73,11 +73,12 @@ static u8 upd64031a_read(struct v4l2_subdev *sd, u8 reg) { struct i2c_client *client = v4l2_get_subdevdata(sd); u8 buf[2]; + int rc; if (reg >= sizeof(buf)) return 0xff; - i2c_master_recv(client, buf, 2); - return buf[reg]; + rc = i2c_master_recv(client, buf, 2); + return rc < 0 ? 0xff : buf[reg]; } /* ------------------------------------------------------------------------ */ -- 2.25.1