Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1147803pxb; Fri, 27 Aug 2021 02:17:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv89ugvVu960hkn06CCw3lUwoXbYzz2hF+eajjDYOglFmjJ7uBsEnCR1S8J91JthKM/F7v X-Received: by 2002:a92:cb08:: with SMTP id s8mr5724116ilo.166.1630055863903; Fri, 27 Aug 2021 02:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630055863; cv=none; d=google.com; s=arc-20160816; b=nkhpShGZ7DGNzmjYgqRlV87eatzQx0Yg9VBJnOuhOD4U9sLhljks6vriCB/GdpIldb XyqE1ZjWGS+Q3v0IDxO5X5h6TQZi06lM6MhAfFq7tbWE3RDMmIyqXKXEj41lMpaMlZKC ObMPUM7MRF0bez0oqnwgsBheDjCktP+avIhFZi7/29/2ZPj3PLoNknsTow5Gd1DjmiCy TWmy33YFDdENGftBH9BhYvck2VK0KYZXpj2vhZ09ICC8UGE4OnY0ea8rQNENXh1wJ0lj rSWzvlBcHMpqyttSZLvWTGDHh3FqIHv1JnaCAzfldFlgJFLZjghguiTEKUR3JrHjbvCn bAlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=VwzfECxpCdVoPZvMBUhjsZ1CU0bHcG8tMQUcJoB03Mc=; b=VHh/SxYuPWi6dvCsIMsZw7Y1zFeyV35cx28z+MwI/4CewRIuxWMZmy1OQjLylW54GT +3idJbshntt97lHwColK67T47m9bwqEgFLMkdsFR0QTJIC31vCpMUGR0OwG+Z99Bnme/ jZIjCPePbQMdiuv+0Eg2DYLWxOmBvZR6SpcXD7cd2ESTQL/UTDYmpM54vRaxaVcVhGvs gcvZT15tFG/vJz2437nfhfwkX1toYTXq9rZFS1iak69SmmZMbeMdbOIAvS5X8eAOvNwk wLy95jIo1cHnMgt1NAAbMSWbM4VmtAXXMfmiEXIl863HWNCC6T+xoxN7N/9F0nAm9SXf ehGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U6YJzYHh; 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 x8si5561495ill.70.2021.08.27.02.17.32; Fri, 27 Aug 2021 02:17:43 -0700 (PDT) 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=U6YJzYHh; 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 S244668AbhH0JRU (ORCPT + 99 others); Fri, 27 Aug 2021 05:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232282AbhH0JRT (ORCPT ); Fri, 27 Aug 2021 05:17:19 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ED37C061757 for ; Fri, 27 Aug 2021 02:16:30 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id g13so12978026lfj.12 for ; Fri, 27 Aug 2021 02:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VwzfECxpCdVoPZvMBUhjsZ1CU0bHcG8tMQUcJoB03Mc=; b=U6YJzYHhiIzC093S977N4kojGE2WwMIjAs6xGSKaleQLY4hI+jPjthAivr0L/Gglbw rMS8U5STB3QsD9UWWCSfk44W4FuDQfh5Wu8apnVfbkJG2LPYy1wbRLzhdEgNHKpuaFnm hLNC4JjpVY+xFm68Tcdh/Bo+E/4edjIbq+9Talzc7BYXyOyI7SDEknfVB/k2QSbRJBwM 5Oj2GYe2HnqMJfM7QHWRDHau5p0hiyiIypJ5SIG4A4M6WDMSoZAGExo5TW1Au22D6g24 3hPbgoxNVgzSN+HjavzL4o8xdIw819E6P1kv4qQwznfPyroedtmLrhBIMCLld5O3cNFa OGgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VwzfECxpCdVoPZvMBUhjsZ1CU0bHcG8tMQUcJoB03Mc=; b=ZVaJviuPtMPq6iUyRVK7qHn6k7WEfEsh83GXd+/d3EelSvCEM7ymKv97FQRXIHKYUI NbU/phT8ZM8lNZSbWnUr6MsR1loqPHsQmaO7svVAC+DtVFFsU27SLzwvqZ0lZt1AUDVs AVRMTvgBr5Txq1X2dD8OYofPCIJM6y2UbJNFZrj4rJSbCFRbNA/JuRoNA3i7Dgc5xRLA v21npsHLgkoHqdVFdUkxegCBXsOwqBDTd0jGUWfTf0C1tOmBaP0OB2kdzUjXgfKi0b1W f7+9dKtb3YtZITSgjtpcBFYoDqkEDhXLPq/kwIIv5g3bzczLFwFbfYVgXUp1wcu0sfY2 PhWw== X-Gm-Message-State: AOAM532dqwY+k99ELstex3z6cSI1hpSX8GotUNVzZxfGu0IswdCqaWdo ctam1EYN9mDAK2SURz5L1vGd3r0jM9luiA== X-Received: by 2002:ac2:5456:: with SMTP id d22mr6112299lfn.139.1630055788705; Fri, 27 Aug 2021 02:16:28 -0700 (PDT) Received: from [192.168.1.11] ([46.235.66.127]) by smtp.gmail.com with ESMTPSA id m28sm615005ljc.46.2021.08.27.02.16.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Aug 2021 02:16:28 -0700 (PDT) Subject: Re: [PATCH v3 3/6] staging: r8188eu: add error handling of rtw_read8 To: Dan Carpenter Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk, gregkh@linuxfoundation.org, straube.linux@gmail.com, fmdefrancesco@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org References: <20210827090706.GA12231@kadam> From: Pavel Skripkin Message-ID: <84e04d0e-8a07-aedd-117a-6b6337b865c7@gmail.com> Date: Fri, 27 Aug 2021 12:16:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210827090706.GA12231@kadam> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/27/21 12:07 PM, Dan Carpenter wrote: > On Tue, Aug 24, 2021 at 10:27:27AM +0300, Pavel Skripkin wrote: >> @@ -83,7 +83,12 @@ int proc_get_read_reg(char *page, char **start, >> >> switch (proc_get_read_len) { >> case 1: >> - len += snprintf(page + len, count - len, "rtw_read8(0x%x)=0x%x\n", proc_get_read_addr, rtw_read8(padapter, proc_get_read_addr)); >> + error = rtw_read8(padapter, proc_get_read_addr, (u8 *) &tmp); >> + if (error) >> + return len; >> + >> + len += snprintf(page + len, count - len, "rtw_read8(0x%x)=0x%x\n", >> + proc_get_read_addr, (u8) tmp); >> break; > > Oh my goodness... :P > > If you look at what proc_get_read_addr is, it turns out it's a 32bit > address which is controlled by the user in proc_set_read_reg(). LOL! > Just a giant security hole. > > My advise is just delete this dead code. No one is using it so how > necessary can it be? Yep, it's dead code as was already mentioned. My plan is to convert all this code to sysfs. One thing I am wondering about should I include these changes into this series?... With regards, Pavel Skripkin