Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp141645iof; Sun, 5 Jun 2022 23:37:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjunkulyfYhejFVBwx74uN4BoHc2bWW+V2Gu/tQSoUmt0qgyOWqvsFM2lP8ABvu74X9LTA X-Received: by 2002:a63:89c1:0:b0:3fc:6001:e871 with SMTP id v184-20020a6389c1000000b003fc6001e871mr20173994pgd.14.1654497420753; Sun, 05 Jun 2022 23:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654497420; cv=none; d=google.com; s=arc-20160816; b=vifj5J0Bk+8JJsg37W2kY/I/0obKLkcgci0G9gDBfEzD2AWkvtwJHkr6LPKVCh2WFM tV22MbaBDdlbh1CTlCy6aqoFCwxSQdpUwmKhnQobwjBsPEI5HmipOCvVq274Rxtty+44 nSIK52nxZLf33fZfxyNV49KSpDfmjufIxJPyTb+Lv99SowXuQi/7jsa7omLODY47fPQQ vw2jrTR4b3FdXv+aib1JqOnGlVARlAuShBd6PJVjUI/ZCEDd6rojmF9dRWr8JRV9DN85 Wstt6CQzEgrKSe3eQyO6IhEzdBZhWsXiS7/Q0q1QyTB8g+DmesxKCQuCenI+xzQVcLJw ym+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hFKLMrkF+XHMHQ85sMx1W1LLjEEyAJsW42RmTrdJFpU=; b=r9EqpieL/3azmeP9DCeLoNPoQLhZ9BRlOFBFgJW58NH/JPPmh3MviqAtrMO3H1LFaN 9Wyy1laMHUZIqwHoBBQxbyUtmx5OThdvdwWyFHUyQaVzQNmqa+kAhtcyiDd0ULDdgnVj sCHkvE0kk2nLf7Ezzu7sfJpTktRen6458rIXoUAWlv+g5x5SFPjHdhPZ4hHopqK/mCIq dXl4liVeQeP06NEvNAVOz8ZsaOqRGvPFO1OZ2M96oM5ok4NFCz0pId8N688n3vAWpAqu oaYhBzOLJXnPfE2wCQsOZ5K5YX2XFPguNCas55Ag5QnOi5ZW0LiIjHAoN7ipDTPsro3h qtxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m+z3WMkQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p9-20020a170902780900b00153b2d1659fsi6049765pll.423.2022.06.05.23.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:37:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m+z3WMkQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4BF892D1D2; Sun, 5 Jun 2022 22:49:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229708AbiFFFs5 (ORCPT + 99 others); Mon, 6 Jun 2022 01:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbiFFFs4 (ORCPT ); Mon, 6 Jun 2022 01:48:56 -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 BA9852CCB7 for ; Sun, 5 Jun 2022 22:48:53 -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 3B2A460F95 for ; Mon, 6 Jun 2022 05:48:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 414E3C341CA; Mon, 6 Jun 2022 05:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654494532; bh=Dvz2wGZ0SUD3hGXKJv7F+hdhAS0fs0Hbg/vlNnnbu04=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m+z3WMkQml0kACZBfXKVHiwEluGjiPMXHHkh1Xsjlju7rllZb+S/QgR2iofAO3pkk FZ8Pw6HwSSXZsb0Y5vzhy27dNt8fR2BWo4+mMVsZat2i3t2QNjsk5uDCxyu2vzsvL0 mCf/j5jWCzNrqIRGwJ3k3c8HnXP9ta2KQycdobsU= Date: Mon, 6 Jun 2022 07:48:49 +0200 From: Greg KH To: Pavel Skripkin Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk, straube.linux@gmail.com, dan.carpenter@oracle.com, fmdefrancesco@gmail.com, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH v2 2/4] staging: r8188eu: add error handling of rtw_read16 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 20, 2022 at 12:09:55AM +0300, Pavel Skripkin wrote: > rtw_read16() reads data from device via USB API which may fail. In case > of any failure previous code returned stack data to callers, which is > wrong. > > Fix it by changing rtw_read16() prototype and prevent caller from > touching random stack data > > Signed-off-by: Pavel Skripkin > --- > > Changes since v1: > - Fixed style issue > > --- > .../staging/r8188eu/hal/rtl8188e_hal_init.c | 21 ++++++++++++--- > drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 8 ++++-- > drivers/staging/r8188eu/hal/usb_halinit.c | 27 ++++++++++++++++--- > drivers/staging/r8188eu/hal/usb_ops_linux.c | 13 ++++++--- > drivers/staging/r8188eu/include/rtw_io.h | 2 +- > drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 ++++--- > drivers/staging/r8188eu/os_dep/os_intfs.c | 6 ++++- > 7 files changed, 67 insertions(+), 19 deletions(-) > > diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c > index e67ecbd1ba79..6662ebc30f7b 100644 > --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c > +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c > @@ -249,11 +249,14 @@ static void efuse_read_phymap_from_txpktbuf( > hi32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H)); > > if (i == 0) { > + u16 reg; > + > /* Although lenc is only used in a debug statement, > * do not remove it as the rtw_read16() call consumes > * 2 bytes from the EEPROM source. > */ > - rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L); > + res = rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L, ®); > + (void)res; Same here, that line isn't ok. thanks, greg k-h