Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp493238pxb; Sat, 6 Mar 2021 06:32:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzV81sncyl0I8jK1I22Smzi10uVVzrx1wed51APj9fDrAXVaePIa9esw6EDCOkSM7mFIEXR X-Received: by 2002:aa7:dd4b:: with SMTP id o11mr14087627edw.303.1615041150443; Sat, 06 Mar 2021 06:32:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615041150; cv=none; d=google.com; s=arc-20160816; b=ofqzWQ06jbuoOwW3YmKNHnNsCvEAaKOrpIm1PFBuWxLtwDdA1ttsbkZF52D6RQWQT0 For/csSUl3/ZMBv7q7JfGHwdsWpYgM3f4I50dNMupM0rYzODshL1g3rSjKA8agTfzvMP MzRiSo+FQg2mS1ewgggxg2h0OUg54Ht8piRYRLCQ/b/tDmjOX0uq+un158xkuVGp+Pax nycnC4sUZXcmS/0o3OlA54WLvX3OgMS2III/GpUOnip+96sBxeg/trO+pN7OzUYXgKSp LSeDlEIzCqachIxhnK472Wmydh8otwuVDe4KU4kCu2s+KwzKMFh5QZ9IzuYKcLM6Vh+E o/sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=sTssXhzPVHELqYGgO3fz4klNiS/VEUisGSmKd9f8OhM=; b=B36aHY7tuC3DVvWOaKJkOfYTeHnoBBv8B8fF8BxeLiOhW1msrFMuO6tKxb0w7KzpEo rSfDhY4Zse6K012SGKi5v1JLGN25nuyvFJo9I4KcfyEYSx31et0bwJ1W51YdZH/Wrskb 5pyZlyFIpVEuxNVcFaSNvZgoSRbYx+M9nCi1XQwYk88Qsmr+IioK8jreGmNOVqvsz9Um hheQFdJcapK/IHCEe7IJI6otMIxBTYgCecGW1Iy76FXDyicAHF9vXJEEUJV9Lu1WGjTA vJVPgpuRAHDiLHSWjsSEMPp9X6+NjdVzGJe2d9QpG1XxQeJs3/utm3sCAGr9MY0BsMrG g+GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HuQ2h7BO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o21si3293210ejc.724.2021.03.06.06.32.06; Sat, 06 Mar 2021 06:32:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HuQ2h7BO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbhCFObI (ORCPT + 99 others); Sat, 6 Mar 2021 09:31:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230197AbhCFOaj (ORCPT ); Sat, 6 Mar 2021 09:30:39 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1B58C06174A; Sat, 6 Mar 2021 06:30:38 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id z7so2830463plk.7; Sat, 06 Mar 2021 06:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=sTssXhzPVHELqYGgO3fz4klNiS/VEUisGSmKd9f8OhM=; b=HuQ2h7BO1J26rYlSbkXhPkHeTa31R9GDqcv0uc8nS0qTxiTxiEHn21uUSeY0cgsuwj gu/dqp+ZGniDlkbL1k29e670cmSUN6+TI9YL+rHjCIlSMyx6rEHgOnY+h/6Ajb1pmdhi bZCTGR3M4hbzoRN/v9C+H6QTceuFhEk0QMzFCu/ud3b2ezL82ppwDqXZ/7HJ9NjNX49u us0GtXtqIXO6TwLZp1tmqYzR2Fi4CLY8YM2SkWrbTHVHZcNiMtooQU2FF4X8uAZOxZbt OHrWmp4WFup1B4iUpNemc6HY9AU0IOmjDyNk18A/jota3Np4ucNBtYCV8MvvvW+0Qlsa GujA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sTssXhzPVHELqYGgO3fz4klNiS/VEUisGSmKd9f8OhM=; b=V4cJyoJhGioIgt/tH6hUbMzmJO2xELK5HVc5XbHR9QpVt/LqwlHzoV2IuKygCtb/G3 nF7qN1ZbK8itbJrrc9Hp5Qo+g5Q4IbkPALIFT+aa/1adxqM6uyV4lMB1gJ87FIwt1WKD G9bKlN4NygwDU3Zih4lCF0zfGkZE+u8WgaOmkwEutcTUYFXJNgOJnGDlGaWb+QRAoP9+ dobLdHOnRtAjfUDYWj0HgoQXbSKMwbQ2stei3PjYqzZLuTKocLBimDVtcw1Xse5kjEKD Tu9XTGmFFN1qF8j1Ah+NOvYoRo4r9K4X1Kvdbw8wgzWM3PEK9ZLT/BAp4bTADRBzx0s1 YrDw== X-Gm-Message-State: AOAM532q7YiyPxyqTgCwHk2veO67/HSxq5mgmGNJ0DbLAPQd4csMC/ZC lEzXOpz1C4uOPcCWCskynLo= X-Received: by 2002:a17:902:e54c:b029:e5:e7cf:d746 with SMTP id n12-20020a170902e54cb02900e5e7cfd746mr9398991plf.56.1615041038383; Sat, 06 Mar 2021 06:30:38 -0800 (PST) Received: from localhost.localdomain ([45.135.186.79]) by smtp.gmail.com with ESMTPSA id d24sm5546288pjw.37.2021.03.06.06.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 06:30:37 -0800 (PST) From: Jia-Ju Bai To: mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] media: tuners: fix error return code of hybrid_tuner_request_state() Date: Sat, 6 Mar 2021 06:30:28 -0800 Message-Id: <20210306143028.19457-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kzalloc() fails and state is NULL, no error return code is assigned. To fix this bug, __ret is assigned with -ENOMEM in this case. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- drivers/media/tuners/tuner-i2c.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/tuners/tuner-i2c.h b/drivers/media/tuners/tuner-i2c.h index 724952e001cd..26cf7da29f30 100644 --- a/drivers/media/tuners/tuner-i2c.h +++ b/drivers/media/tuners/tuner-i2c.h @@ -133,8 +133,10 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, } \ if (0 == __ret) { \ state = kzalloc(sizeof(type), GFP_KERNEL); \ - if (NULL == state) \ + if (NULL == state) { \ + __ret = -ENOMEM; \ goto __fail; \ + } \ state->i2c_props.addr = i2caddr; \ state->i2c_props.adap = i2cadap; \ state->i2c_props.name = devname; \ -- 2.17.1