From patchwork Fri Feb 16 12:40:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Burakov X-Patchwork-Id: 202111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp487279dyb; Fri, 16 Feb 2024 04:51:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUFoScB1tqbJtbUAc9cHzO0zO9/ppv2mJkC6VZu5qo2Glvzjvu3tOpA8vyOqVZwl0KJPGCJmPItPc8kBpdRTbe/fXTjg== X-Google-Smtp-Source: AGHT+IF2QcdyyYaIeFrzCemJhvDP3uA1Uzw8oAUk5HYhGkRwbxlsNebP9u7HIO+yI2j2fCRRjLT2 X-Received: by 2002:a17:906:a88f:b0:a3d:d9a1:e25d with SMTP id ha15-20020a170906a88f00b00a3dd9a1e25dmr1151633ejb.37.1708087861061; Fri, 16 Feb 2024 04:51:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708087861; cv=pass; d=google.com; s=arc-20160816; b=VvzjGs6Jh8JIgewgjoB6K7B8KZhXUdq8hACYJWJ+BzxYPqzWM+VZwFB6TADC58K4AF IdsoLHRgwJi8sQQUkhACrXiZQHSgBoXgnjFiRuL2PEajloe5L6ErFqNDmiWxx/sb3GBd imNp1UJgAtgqLpw06RA71Wbu3zLzGFIqDQIw/EFzRtix2JcS3Aq+5sHUWylrLILz1N2v nJMNixrrZWfuLvlwkvVPCVvBOaJcyd9zft/ZnRaOb3FR0FfVhuM7w9JUSnmJImkGHr52 d5DrqTrH8MvgBslS6sFhH4NSnDe2ONLVGqOq9xDdLwJDiT15lDZ2YyzHOJglrsxt98Cs ND6w== 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:dkim-signature:dkim-filter; bh=zgV0ivj/OEUx/r+edsUgWjC2NypknE++yAGJ22q5QGk=; fh=nuT+mw7Hui8Yu7+oL+bFJj6TzEfmcZTt1zAjn/fIRbM=; b=0nytvYkZXKExvFtaXG70eNfVGhX9B2u+0qamdbRx3MIA+9d3pXAJMoKpy+5by75Rsg ybXp7QAGVbG7cmzCguinbikbn2KxU34BNTd7M4oH3LV6AiT9OLfx4XJ/auxiA73YywTW JXOfvROAWA2JclfKbU0MHwfDbcvqKbOPsAXTPppw8iTe3PIe1zh3nE9cy70NE4Mj5Y4H pub6IxkQQcbE4CiLxR+vHafWppoaTTbroyvpDEJY7MMmgu6DtAvAzdHNU9mb3DS6uVbr lJui77DW8MtIeM3iz/P299KDgAfkKQrMuJODqsPr6iNoLO0E7Etof2Ohush4EGXualC4 RPSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rosalinux.ru header.s=1D4BB666-A0F1-11EB-A1A2-F53579C7F503 header.b=OBnE1toA; arc=pass (i=1 spf=pass spfdomain=rosalinux.ru dkim=pass dkdomain=rosalinux.ru dmarc=pass fromdomain=rosalinux.ru); spf=pass (google.com: domain of linux-kernel+bounces-68596-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68596-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=rosalinux.ru Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b6-20020a170906660600b00a3d16bd35e3si1570070ejp.1002.2024.02.16.04.51.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 04:51:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68596-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; dkim=pass header.i=@rosalinux.ru header.s=1D4BB666-A0F1-11EB-A1A2-F53579C7F503 header.b=OBnE1toA; arc=pass (i=1 spf=pass spfdomain=rosalinux.ru dkim=pass dkdomain=rosalinux.ru dmarc=pass fromdomain=rosalinux.ru); spf=pass (google.com: domain of linux-kernel+bounces-68596-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68596-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=rosalinux.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 AC6931F22363 for ; Fri, 16 Feb 2024 12:51:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D40DE1292ED; Fri, 16 Feb 2024 12:50:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rosalinux.ru header.i=@rosalinux.ru header.b="OBnE1toA" Received: from mail.rosalinux.ru (mail.rosalinux.ru [195.19.76.54]) (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 DEA062CCB4; Fri, 16 Feb 2024 12:50:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.19.76.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708087841; cv=none; b=aegjf+3bGz5LqLszOI+gQ23Zw2/AfnHAWZKMIvpO+oDLxM4y02Iw2m8XgwPpvQj7tvcODDOCt0+uM+XbV6xvpyIoWjJVvhxbRaYWz776/FNXwnTzRHzFO0fvIA8dxeDpEqErA5BJx2yISBkk8wa94tAJq36a2qEXDl8ZktRJWoU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708087841; c=relaxed/simple; bh=k2fpWlsq3ikrp8PHJJJBcQSXhbD5PcQPjZovIN5SiKE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=tOUw2cvAP9RLs4VoFl+mhaYXC2UWSn2MPNIoYA5HHAUbGUsmuNVTDIjvGJcYFOeifU+UU1KpscOyawEmkVxyfWCfV1lPe3+yro73o9kN1MzoUmZqSpuAuMjC8UUfsX7JpqOhY4gs0FnX4tSqMKyNphUringUxyfSzt7ZxqUTuoI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rosalinux.ru; spf=pass smtp.mailfrom=rosalinux.ru; dkim=pass (2048-bit key) header.d=rosalinux.ru header.i=@rosalinux.ru header.b=OBnE1toA; arc=none smtp.client-ip=195.19.76.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rosalinux.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rosalinux.ru Received: from localhost (localhost [127.0.0.1]) by mail.rosalinux.ru (Postfix) with ESMTP id 6DE5418575DEA; Fri, 16 Feb 2024 15:40:28 +0300 (MSK) Received: from mail.rosalinux.ru ([127.0.0.1]) by localhost (mail.rosalinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id yTkEI9-BT0By; Fri, 16 Feb 2024 15:40:28 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.rosalinux.ru (Postfix) with ESMTP id 3C67A1859D618; Fri, 16 Feb 2024 15:40:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.rosalinux.ru 3C67A1859D618 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rosalinux.ru; s=1D4BB666-A0F1-11EB-A1A2-F53579C7F503; t=1708087228; bh=zgV0ivj/OEUx/r+edsUgWjC2NypknE++yAGJ22q5QGk=; h=From:To:Date:Message-Id:MIME-Version; b=OBnE1toA9i06HkfC7k8Q2ftnCEJ95/C/kobi4hfdtCJuoHST49Uloz9mYnMHED9MF waEdFoQlrN3tADQJsGGiPtHQPmdGISVjRJtGUWGSbq8ALxbA6/a7bSx+X6sgtS3xEi 703fzxlXkEe/JEGm55nnwefGh96LMaTnbcRCSuoW84djwwHhTymWArnDiLm3JCmmrs 8NJfKcsLFDSU5nxE4GDqylcaLEJwdiohuAaORB5Me5y6RpdlVtgT8WFHdTWplIu4lX RnSYdRiUeBVhSjD+XiNCAxyDvptpS5GxWF2L6Q1EUJ6DHa85MBal/QfiuI1GLbk+m5 6GhFh/36hDnzg== X-Virus-Scanned: amavisd-new at rosalinux.ru Received: from mail.rosalinux.ru ([127.0.0.1]) by localhost (mail.rosalinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id W8JxpCQNt1ZG; Fri, 16 Feb 2024 15:40:28 +0300 (MSK) Received: from ubuntu.localdomain (unknown [144.206.93.23]) by mail.rosalinux.ru (Postfix) with ESMTPSA id EE6151855EE38; Fri, 16 Feb 2024 15:40:27 +0300 (MSK) From: Aleksandr Burakov To: Mauro Carvalho Chehab Cc: Aleksandr Burakov , Hartmut Hackmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] [media] saa7134: Unchecked i2c_transfer function result fixed Date: Fri, 16 Feb 2024 15:40:06 +0300 Message-Id: <20240216124006.18896-1-a.burakov@rosalinux.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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791059936699056769 X-GMAIL-MSGID: 1791059936699056769 Return value of function 'i2c_transfer' is not checked that may cause undefined behaviour. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 2cf36ac44730 ("[PATCH] v4l: 656: added support for the following cards") Signed-off-by: Aleksandr Burakov --- drivers/media/pci/saa7134/saa7134-dvb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c b/drivers/media/pci/saa7134/saa7134-dvb.c index 9c6cfef03331..a66df6adfaad 100644 --- a/drivers/media/pci/saa7134/saa7134-dvb.c +++ b/drivers/media/pci/saa7134/saa7134-dvb.c @@ -466,7 +466,9 @@ static int philips_europa_tuner_sleep(struct dvb_frontend *fe) /* switch the board to analog mode */ if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); - i2c_transfer(&dev->i2c_adap, &analog_msg, 1); + if (i2c_transfer(&dev->i2c_adap, &analog_msg, 1) != 1) + return -EIO; + return 0; } @@ -1018,7 +1020,9 @@ static int md8800_set_voltage2(struct dvb_frontend *fe, else wbuf[1] = rbuf & 0xef; msg[0].len = 2; - i2c_transfer(&dev->i2c_adap, msg, 1); + if (i2c_transfer(&dev->i2c_adap, msg, 1) != 1) + return -EIO; + return 0; }