Message ID | 20230328124416.560889-1-harperchen1110@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2187822vqo; Tue, 28 Mar 2023 05:48:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bHNTypVgMPdyc0D6BDu1E/MNv4Xr6GPRrQXb23q2mBMp86c0y7BwDvPOD/knvQKJRSceTL X-Received: by 2002:a17:906:4a55:b0:933:2ef2:7c66 with SMTP id a21-20020a1709064a5500b009332ef27c66mr15749549ejv.2.1680007693507; Tue, 28 Mar 2023 05:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680007693; cv=none; d=google.com; s=arc-20160816; b=06jumoTX+LAbMONeIlyLVP6/az/2KQn3XVSGEsN5pPCAui2Ps79JPF7kwzifVEZZ/G hocgiYc4DMH4ppo2KNCQasOQfs6AhDP+mrQO8PQwaj7L0Vqe5MPmo0ybTgD8gmHStBOX Rx4e9I58nsDixI3HhzwyzKrP5qw4N/NbqVttqJlZ+AVrOqCNfu2Nq3/04VYBo5gF5IzD Eoz2INEX+FMXculwqpGhlqNLr9l2avdnFZJteOmChZ99xmof2ub5wwXdyvAed4P5xACK //KGjsM+Kz+5suz0Gz2/1ad13RkhN0yNrc7SUTcxdBGiyHjbwildfJlLkPURwjlL2B8l QFPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UYM0LDWTymu0bPPL77EcCh7NegRUDjN6g7FPTmBma/w=; b=KHLLWthhgz0tEiC+s7TlVE9QdxQoGN1BS8IFLfAC4r5yvqEWv984VXKZEf+o35MGFB vtyyYXPEYySaghHwh8P4i6VZ8kKp9LVr8cpAmalor1RNPlMwZBXUCdvgqbT8RN8+30LX HBynyxdWKOsXA+oOmKqvcp7z6MH4uSJXQlfrTzrjOFfTEntExvBSKD6mbJNqSDEbiwlw OkCm36MYsP1JA/k8t0oYrrSRVccM0E9xWu7YAzONym4YeZHMD/WD4aOeDVQT9Sc8bnBL c9GYIxkoV7nax2lGGs1FOV9mQlEc0hCv9u/PRQ2/2gyk0xgYxDMm13E4nhFknhiRPk/C lJzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JjUm88X4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a170906118f00b0092fa562c84fsi32850915eja.33.2023.03.28.05.47.48; Tue, 28 Mar 2023 05:48:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JjUm88X4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230478AbjC1Mo6 (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Tue, 28 Mar 2023 08:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbjC1Mox (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Mar 2023 08:44:53 -0400 Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 109EE93C3; Tue, 28 Mar 2023 05:44:24 -0700 (PDT) Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-536af432ee5so227762287b3.0; Tue, 28 Mar 2023 05:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680007463; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UYM0LDWTymu0bPPL77EcCh7NegRUDjN6g7FPTmBma/w=; b=JjUm88X4RKhTtd8pJK8O1h2ETqz0s9W+HLALN2xHbiPTPfx1d8GbfHK/c+50Xmbiac Ys39w7Ej6CYzi+oVWrgRXPPeQEBJX9vBzHBeQAd9wzYeOdpgH15oJSwE0jfgGwIbLGg7 DIuD9nQBp3cRYtL3ShOuygmcXUEP2gHyrhDv7xD9REhX0s2dInRyXhvV94ED3A3ejcTL IiCblLp/u0v1OJBS31IHUN7MnBDYm95/eE+XjeBUSOepAfcJtqFAa3E8FSsfu8QSyG2B Pxa5JTOCnsKpRW90ZZJC4222jn4OVmCHyZwFh/f3MJnDJbtniqa6Gniaf1zfcuo0Kj95 1ySA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680007463; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UYM0LDWTymu0bPPL77EcCh7NegRUDjN6g7FPTmBma/w=; b=j+Kp/W4Xsb9OpKFDz1/IpYlbQqbO6jN0QT1AlP7HyeLuH0j/HqrM4vuSolH010RIgn gC32g0loUsWemPH53bcUjCknhPal/v6PucblO05vo5XIvPQ6eTpalWoKsMGHtlrR/dDx 7HbeULeIGLfHIAiyxB5gE/TtDW2oeGEJBgI+mSxernxE0BWuuvbSaIFcO9tzgSMGpKpc raQGMp5jkudNunGWTWkQpD3D0Wh2EaPbTc+yamLz7EpLyeXJ067vGT3nutvoAqYu6bTP FxF0BVHMN6JiK3sZU6H9MSjrWvtfAG6Ldia4h0r6Q/jsSM54emGHlqmRs3pTOWS/602V oFjw== X-Gm-Message-State: AAQBX9cpUTgcREwayZZDJvLmrCaYEVnN9oI7gz4ytsHzVX18VaJ5fd02 BM3+1yZEc8m/WHcKb/NJQTATXJ99BEw= X-Received: by 2002:a81:5a83:0:b0:544:7850:b62f with SMTP id o125-20020a815a83000000b005447850b62fmr14323652ywb.18.1680007463076; Tue, 28 Mar 2023 05:44:23 -0700 (PDT) Received: from chcpu13.cse.ust.hk (191host119.mobilenet.cse.ust.hk. [143.89.191.119]) by smtp.gmail.com with ESMTPSA id n38-20020a81af26000000b00545a08184d5sm2382152ywh.101.2023.03.28.05.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 05:44:22 -0700 (PDT) From: Wei Chen <harperchen1110@gmail.com> To: mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Chen <harperchen1110@gmail.com> Subject: [PATCH] media: dvb-usb: dw2102: Fix uninit-value in su3000_read_mac_address Date: Tue, 28 Mar 2023 12:44:16 +0000 Message-Id: <20230328124416.560889-1-harperchen1110@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761615747172601977?= X-GMAIL-MSGID: =?utf-8?q?1761615747172601977?= |
Series |
media: dvb-usb: dw2102: Fix uninit-value in su3000_read_mac_address
|
|
Commit Message
Wei Chen
March 28, 2023, 12:44 p.m. UTC
In su3000_read_mac_address, if i2c_transfer fails to execute two
messages, array mac address will not be initialized. Without handling
such error, later in function dvb_usb_adapter_dvb_init, proposed_mac
is accessed before initialization.
Fix this error by returning a negative value if message execution fails.
Signed-off-by: Wei Chen <harperchen1110@gmail.com>
---
drivers/media/usb/dvb-usb/dw2102.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index 0ca764282c76..8747960e6146 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -946,7 +946,7 @@ static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) for (i = 0; i < 6; i++) { obuf[1] = 0xf0 + i; if (i2c_transfer(&d->i2c_adap, msg, 2) != 2) - break; + return -1; else mac[i] = ibuf[0]; }