Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp409205imn; Wed, 27 Jul 2022 09:27:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sbp5qNwHvjRKyb7bI1ps3+9ol/O5rg4DXcBZvUK6tT/HbLrJ5FZp8o0vFFofhPmOqAgvTG X-Received: by 2002:a17:907:94d0:b0:72f:269c:3aa3 with SMTP id dn16-20020a17090794d000b0072f269c3aa3mr17840879ejc.695.1658939252086; Wed, 27 Jul 2022 09:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658939252; cv=none; d=google.com; s=arc-20160816; b=Z2ityoy/TQIgdQXPMgtiSt1l7sQfrHIMKQ5rM5GSwVDzIShP3Ki6J3Css9XKUqiWrr aSOdG/3DOYHDUQGxLXb3oQ7d0vM5G2D7C2OpBTcTXnVIhMsWWFB+tlOQgAOkf+DR7jI2 RQt/A1xCAXyA1CsqpS/BFLTVqjaDXVfXA9csaoS/NhlxkpgrsIMrW3Tc1Svxt7FAp4tb RiNQQzJoS3s1jku7w9b7m6NBbMali1Jg1pD1ZPKosObS8DGBmbQIQM84eNHKG7OoDOke 8QE4UG4J2Liek9dZJUCrMPm2+/gHhB4o4ZEhnq5Ai6X232L8pokwlIf436FJl7+a0mSe FcMg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CF15/NpSZ5qKw0abPEQ4m89nw+LUJFu3Sj74NrQhtos=; b=W5yoG07E++B8iyHz318gL/DFfNVP/0/ADjRhJpX/yK+5zxPRq3MIGJVrkcVfICSvTs h58yyqBv+rYfUweWqgIf2K8/AiWGXuWle5K20HGpFGMABuuTyxhFXrFEZGJDL34pN2TN x1jlkgEQag9WUakZGybNjDTLHX6jE2DdabZc8Ke5iA5t4fU29me0lKTQWaxC8EnSL9Vz J6DV/kJhAFRslrjFpb5En2FIIczU2pjJsKs+GUEOmKMEWMKmxkxxa0TkwSFdSWVaFxU5 5ceybW0pQ1ANB/nQhMvlpiviEcsd/hnLegKP59GzmEp6b/nORNZwW7ZJLlY+vfMVf9OL Hl9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ChQ7W6KZ; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr18-20020a170906d55200b0072b3b4f015csi20641759ejc.311.2022.07.27.09.27.06; Wed, 27 Jul 2022 09:27:32 -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=@linuxfoundation.org header.s=korg header.b=ChQ7W6KZ; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235727AbiG0QXD (ORCPT + 99 others); Wed, 27 Jul 2022 12:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235145AbiG0QWZ (ORCPT ); Wed, 27 Jul 2022 12:22:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AA004C616; Wed, 27 Jul 2022 09:22:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9BFD2619BF; Wed, 27 Jul 2022 16:22:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4222C433C1; Wed, 27 Jul 2022 16:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658938943; bh=Okep6Jt9kN+VW7sygVkWdndpohFXPsorOiiSUiUZ+hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ChQ7W6KZCqqJAap7GUPP/VWaoB1kEC/bdsPNCqocES1gOCthw5C9JJCMcNvcAk5Bv tST07GjBqjbAcFG8O4lDmec+YkJqWEzA43zSBiDvBvpKsKBlLkNmLOyZmNOFbhhEBX Ld8qIvCMshOMPK5kP9wT5Mj+kXn3jOLzytjMHvt4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , stable , Shuah Khan , Sasha Levin Subject: [PATCH 4.9 05/26] misc: rtsx_usb: set return value in rsp_buf alloc err path Date: Wed, 27 Jul 2022 18:10:34 +0200 Message-Id: <20220727160959.355318920@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727160959.122591422@linuxfoundation.org> References: <20220727160959.122591422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Shuah Khan [ Upstream commit 2cd37c2e72449a7add6da1183d20a6247d6db111 ] Set return value in rsp_buf alloc error path before going to error handling. drivers/misc/cardreader/rtsx_usb.c:639:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!ucr->rsp_buf) ^~~~~~~~~~~~~ drivers/misc/cardreader/rtsx_usb.c:678:9: note: uninitialized use occurs here return ret; ^~~ drivers/misc/cardreader/rtsx_usb.c:639:2: note: remove the 'if' if its condition is always false if (!ucr->rsp_buf) ^~~~~~~~~~~~~~~~~~ drivers/misc/cardreader/rtsx_usb.c:622:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 Fixes: 3776c7855985 ("misc: rtsx_usb: use separate command and response buffers") Reported-by: kernel test robot Cc: stable Signed-off-by: Shuah Khan Link: https://lore.kernel.org/r/20220701165352.15687-1-skhan@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/mfd/rtsx_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c index 134c6fbd9c50..fd859a7872a6 100644 --- a/drivers/mfd/rtsx_usb.c +++ b/drivers/mfd/rtsx_usb.c @@ -647,8 +647,10 @@ static int rtsx_usb_probe(struct usb_interface *intf, return -ENOMEM; ucr->rsp_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL); - if (!ucr->rsp_buf) + if (!ucr->rsp_buf) { + ret = -ENOMEM; goto out_free_cmd_buf; + } usb_set_intfdata(intf, ucr); -- 2.35.1