Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1120738pxb; Sun, 22 Aug 2021 06:32:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9XA050gIkB2LYv8VmnQQrjG2/1LA8f0qXozH0P3vtlHEuIjy/tJUzBp+kLVmbkJtdOI9T X-Received: by 2002:aa7:d982:: with SMTP id u2mr32087573eds.164.1629639177233; Sun, 22 Aug 2021 06:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629639177; cv=none; d=google.com; s=arc-20160816; b=E0TIKpjndJu91x8Ar/MON/nYZuypTg+QPzOQZ5K2KO5LqsYOt9bu9Yi1KUg/HUwyib Z0Ca7yfJYVAYN/zgXxyXs40sfyPmL5+fKyW7Zkz0DZwxtTyF3YNZsamlN0LWzzvjFqQC 6Ao8ipcPUquOuU9IP9zNug2oWrHTAzR+AM5eLVH0H0Boq7vgi/E9ABTrwOSxLCGcmSSW S2sCmLgCoEPYGtYghq3LEEvuPxF+M2kNCAd5LyzpKrH7fkexq+GHXd/xTNxwBuxEkWSg fwbyKLBI3JsvkXnZDC8NNqFTRlhSj0VWQBt34fJXnzz4TrGqfoNf7ExWKWVOp9LjIjVK Ingw== 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=YGCFgrZTZCq8EATMmDIc140Mg+wKcmIOYSZAtCOG8TM=; b=psUHvvHp8M7kpnpce/Ecngs4ekbELRHiqN3Gu6fIFvaJl6NgOPJCs/PZqzpwhaW19H hybj1VuYHQN5XLbB6fSwo0NBt8xmRFznNMto8V8gOh/mdRViify6/xrm7MSAi3VOw96R oN7FnSPR9pPFlLQ0V7F7frDz7imig8GB/N3sPomFsmM0NmmSp24az3fjCMuiOZcHPgdZ 8RtWwzgHmZ9s3ajAC/VN72cR9oifb5kmiRU02SKv1fLy1D2x4nudfYU6TRH1wecrlUMx gVO02D+wOf2AkD+YYrsD86pOKHWqhoKk7nAjQ29wKLzpbFKJ3y4Os91EexmmqezZTXIz wcHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=whaSNbTp; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn4si11709490ejc.239.2021.08.22.06.32.33; Sun, 22 Aug 2021 06:32:57 -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=@linuxfoundation.org header.s=korg header.b=whaSNbTp; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231907AbhHVNaz (ORCPT + 99 others); Sun, 22 Aug 2021 09:30:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:50832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230495AbhHVNay (ORCPT ); Sun, 22 Aug 2021 09:30:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 16E306124E; Sun, 22 Aug 2021 13:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1629639013; bh=R9YFws1+havCh2xzlF8mD4WZ2n5VX7IcPxztMq5h5X4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=whaSNbTpC6wDfKbyuM6vIGJSlm7n+Fhaj9FYc/KU7vJjRD01mi0UhTdwvVe1Z1kUh Mh3zX0qCyDRtNh1y/eX7BPrCxCrsraC6UpZNK1DaQjbvOsgxIQekUY/rbVEJbNfQlj ifw5+8cdqdphZwrthuChE6iBH3TkXmGxgztcjfAU= Date: Sun, 22 Aug 2021 15:30:09 +0200 From: Greg KH To: "Fabio M. De Francesco" Cc: Pavel Skripkin , Larry.Finger@lwfinger.net, phil@philpotter.co.uk, straube.linux@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: Re: [PATCH RFC 0/3] staging: r8188eu: avoid uninit value bugs Message-ID: References: <435eea22-da31-1ebc-840c-ee9e42b27265@gmail.com> <2244219.zNr1yEsLHP@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2244219.zNr1yEsLHP@localhost.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 22, 2021 at 03:21:30PM +0200, Fabio M. De Francesco wrote: > On Sunday, August 22, 2021 2:39:34 PM CEST Greg KH wrote: > > On Sun, Aug 22, 2021 at 03:10:56PM +0300, Pavel Skripkin wrote: > > > On 8/22/21 1:59 PM, Fabio M. De Francesco wrote: > > > > On Sunday, August 22, 2021 12:09:29 PM CEST Pavel Skripkin wrote: > [...] > > > > So, it's up to the callers to test if (!_rtw_read*()) and then act > > > > accordingly. If they get 0 they should know how to handle the errors. > > > > > > Yes, but _rtw_read*() == 0 indicates 2 states: > > > 1. Error on transfer side > > > 2. Actual register value is 0 > > > > That's not a good design, it should be fixed. Note there is the new > > usb_control_msg_recv() function which should probably be used instead > > here, to prevent this problem from happening. > > I think that no functions should return 0 for signaling FAILURE. If I'm not > wrong, the kernel quite always prefers to return 0 on SUCCESS and <0 on > FAILURE. Why don't you just fix this? Fix what specifically here? The usb_control_msg() call? If so, that is why usb_control_msg_recv() was created, as sometimes you do want to do what usb_control_msg() does today (see the users in the USB core today for examples of why this is needed.) In general, yes, 0 is success, negative is error, and positive is the number of bytes read/written. Anyway, let's see the second round of patches here before continuing this thread... thanks, greg k-h