Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3160016imw; Mon, 11 Jul 2022 03:12:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vj90L8zXrpB/PzEUYJjCDFJ+lxw7OQzwL+qZvhyU6QqAsXU0Sx0NC26oDabRGLdT0/u04J X-Received: by 2002:a17:90a:bc04:b0:1f0:506d:78b9 with SMTP id w4-20020a17090abc0400b001f0506d78b9mr252142pjr.4.1657534353164; Mon, 11 Jul 2022 03:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657534353; cv=none; d=google.com; s=arc-20160816; b=b+DFjYsYZiYQ01ym2G+TxDqBbXcv+aJVFVaZMdBvsvLYdaNuckibz2QKb9HDtOywyE 3XhT5HzEwbCD5AkZl+e0Ck8i/Su4jFpZVTiQe6/I4esjkkWsCCiTvoQfiarmDWRqjIEl 0JpRnNF2cCHoYzWtxuefcoTdrexJ9hp62FmcI8m8dgWSTn99iIsR23hzB7LNGC24zzxY ugeAwYJM6Km0cY7QVmj3qKNGXtMSHwU1lgqNYlCbbEoMtLscFjowrQ1wLBW6rtTtj2Ik TVBiIWFZH2KSbwFKuMl3MVDiTvkr6CbIlXQwfRWsn45z1HE7kKt3UVps43+jsCZfempN 9T5g== 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=/SU2GV91lyLAr1CWCn5pfPtJaSXQy1OFYxedMzvb4FY=; b=VqiPq7XUu3tGADi/T801xJycQlfeRNa9dVhGtsWGNaECsln0qmTZhuj5i8xbKUxLXO JYL7adBo+jJ5B/dP8ipvIuimHT2nctel7iHe+UysrUhSl2gxFzdSov+u6FPQPamzdznd AU+Q1R0+exK68ZlsUrVS4KQVU806Ey6qELRqs2U0KokPaitK+m9KSF/tL4wQvw9osgAd hNHPz666t/mY8lNCFCvI7M1q6goqzuEkSmxErE9VazF3rbRXlH7YojxNFMbMKDIZ7W0C 7rUt6OnP38YjKUu/TWl9Z3k4MF9wTgA4bgImct5shjtFcx4lZua6XqcA5+wYRoOhHxK+ FL/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0en6wQcy; 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 c4-20020a633504000000b00412825845e4si9001210pga.360.2022.07.11.03.12.21; Mon, 11 Jul 2022 03:12:33 -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=0en6wQcy; 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 S229886AbiGKJMh (ORCPT + 99 others); Mon, 11 Jul 2022 05:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231340AbiGKJLw (ORCPT ); Mon, 11 Jul 2022 05:11:52 -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 BFB532497C; Mon, 11 Jul 2022 02:09:13 -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 5EFFA6118F; Mon, 11 Jul 2022 09:09:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 694CBC34115; Mon, 11 Jul 2022 09:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530552; bh=HnhxTr+4nZF2l5NxyJbulsJQA3Ua+EnyXX1DfFFt/Cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0en6wQcy8qcUqyB4J7KKIYOoXDedpejTRUDO6T19iwG1i/GTD1i5i/3xZpnNRo0bM +AxZCwpMnDTcr5JYV/oVb7CuyovcsoTXOMsPVCjRJ+B0tC+/vnHsTX6rCS4KbfiLS1 K2rHc+Pfvz+1Fvdjte5IwklXEPu5Zg6cdDbueScc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , stable , Shuah Khan Subject: [PATCH 4.19 26/31] misc: rtsx_usb: set return value in rsp_buf alloc err path Date: Mon, 11 Jul 2022 11:07:05 +0200 Message-Id: <20220711090538.619148342@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090537.841305347@linuxfoundation.org> References: <20220711090537.841305347@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,T_SCC_BODY_TEXT_LINE 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 commit 2cd37c2e72449a7add6da1183d20a6247d6db111 upstream. 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 --- drivers/misc/cardreader/rtsx_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/misc/cardreader/rtsx_usb.c +++ b/drivers/misc/cardreader/rtsx_usb.c @@ -647,8 +647,10 @@ static int rtsx_usb_probe(struct usb_int 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);