Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp294421pxb; Thu, 26 Aug 2021 03:23:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3OpC4IeOstC6t26p+qtDJvKFzk0emups222j+4Hs4Eobpvqm7ytGbeB2lOqdFgeeCzjJ9 X-Received: by 2002:a05:6402:1d05:: with SMTP id dg5mr3313061edb.375.1629973433779; Thu, 26 Aug 2021 03:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629973433; cv=none; d=google.com; s=arc-20160816; b=uVfc7Ry4xrl79wU3UVIw+IPjkzkfsK9Jq2Wf3Du/XdNIg1QlvbH0jKbMcAPlz7eZo3 iHYrTqYZcA/a9xgSYcYRmVClWbyQb+LeY9z4KP+H1tkpYWZoJxbj7TdNGD/+sIW6gKD1 ZEryAoNo/PbQ18beFxDubayF0KZ9P/0kjMhjw63TsZeHwqZ1ZIbaFVk6/Yj6NC79jOsi 3s1jUNlTMPcv15/KCfm3MuMbEqosR9BEbbm08YWN5d7OgmbrkoIoWT0rqaOjscNI3vrw l5AyrdfMu56UWH/RiADgZ7KI+FHKn6OXXDszc8XEAE1cO6uUn4ulJztCumSkRuDY+I7j 6Kmg== 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 :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=usGVUATZhX1aGo7kPME3bdKWePiR3q9PZjNSNqSr+hU=; b=nKRZ8SmGIPWy7A33ZGUk0K+6qYfVkSGRshe1L2UIg3pD66w5IZvgMOt56kS0urQn3r 0NQRhwLwOgOT1wZCf8yq9QyubL42yb7S137XIdKnUPyQ4Ro4eh82YERmQOf/mbKB/PGT Oj2f1o6SeymWejHvKzi7HM7b8qMZF3x4vmecMP9bU8m9Xe3gw53QVV8ugUY40hStcyG4 LfLSswye/QnD5yy7HgorSXbkeCMJYEkcANUdRnGxWHhGzNKJ91qCHjnvVDwmxwhRl10q whBrFYUkkycboxKF874B0cydZRJZNs99x+nrDNCzFGS+aAyxNtc+vbA6ctiT0NCJ4GOS 9hFQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ak17si2742523ejc.44.2021.08.26.03.23.25; Thu, 26 Aug 2021 03:23:53 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241276AbhHZKUb convert rfc822-to-8bit (ORCPT + 99 others); Thu, 26 Aug 2021 06:20:31 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:30022 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233409AbhHZKUb (ORCPT ); Thu, 26 Aug 2021 06:20:31 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-47-2J3p7E5dPWKSVpGnjjTmaQ-1; Thu, 26 Aug 2021 11:19:41 +0100 X-MC-Unique: 2J3p7E5dPWKSVpGnjjTmaQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Thu, 26 Aug 2021 11:19:40 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.023; Thu, 26 Aug 2021 11:19:40 +0100 From: David Laight To: 'Pavel Skripkin' 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" Subject: RE: [PATCH v3 3/6] staging: r8188eu: add error handling of rtw_read8 Thread-Topic: [PATCH v3 3/6] staging: r8188eu: add error handling of rtw_read8 Thread-Index: AQHXmLmGl/+E/B1vJUGWAidfG7snbKuFdLBA///xloCAAC/eAA== Date: Thu, 26 Aug 2021 10:19:40 +0000 Message-ID: References: <20210826112745.5e1421ed@gmail.com> In-Reply-To: <20210826112745.5e1421ed@gmail.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin > Sent: 26 August 2021 09:28 > > On Thu, 26 Aug 2021 08:21:34 +0000 > David Laight wrote: > > > From: Pavel Skripkin > > > Sent: 24 August 2021 08:27 > > > > > > _rtw_read8 function can fail in case of usb transfer failure. But > > > previous function prototype wasn't designed to return an error to > > > caller. It can cause a lot uninit value bugs all across the driver > > > code, since rtw_read8() returns local stack variable to caller. > > > > > > Fix it by changing the prototype of this function. Now it returns an > > > int: 0 on success, negative error value on failure and callers > > > should pass the pointer to storage location for register value. > > > > ... > > > + len += snprintf(page + len, count - len, > > > "rtw_read8(0x%x)=0x%x\n", > > > + proc_get_read_addr, (u8) tmp); > > > > That is broken. > > > > Don't get it, sorry. Previous code did exactly the same thing, but > didn't check if read() was successful. Look up the return value of snprintf(). David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)