Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2997890pxa; Tue, 25 Aug 2020 08:45:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtrkPUb5AE7pmby0oXoybRedpTH0uDpyJNSy9DL8iRgp8qflo2USM3YE8qiNeaWCOZ1zzJ X-Received: by 2002:a17:906:edc5:: with SMTP id sb5mr2756390ejb.369.1598370323492; Tue, 25 Aug 2020 08:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598370323; cv=none; d=google.com; s=arc-20160816; b=vs9e1qtkWUxinFfy8cwDwOl9yVIfv5xq8XgwawRYdtkIIDIzrsX0Vq1na5ed26IdDS uQR2jQqK9iOA8nMf96DZ4ySkc0FYPYIdRzCkgciVVLxubXAWf1qLM2nBzXfsxrhdpmhf EEoxqxXE2fsCB4tr2gH4f81aeEVg258KBTi9iFa7njTP2KSfsXntpcmA9bgomgFVDAl0 4EBr8SRmtkqvWUh7B32xyiFLOgamQWr/6HPsEKMgS3wYDrm5ZdxDDqlC88GNR/vnH3nt xykzNNNCkID1+xw/CEQAddSiFNEy8iiiU5COE7hU3uWl+43Yh2rJ592NNu9KBWtzP0q6 odug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3cYx6Y+flurfkO42oo9TnB7uKbSpEmE/XvF6SwM2nUE=; b=U26kwWchL7L4P2Havg1hatCmdqa4se+tn+E2xPm1fZUanUS3y2v4dnwCJk2yJ4Weob /O2lVQtF5eo5yjcIfOJd4y5Eoa4uuOCVe1kQF30x66/F4z3LMqmy15u4qzOAxdLQg3JL LdQitfX1mvvU6cIAsNJs7SpFMdRvmXaNVl3RSH2llybmkS8aC+QGposxEZ3GcW1E1/3o zC7+tL5Un+wyE3P7Q9vAzHxulQjDmD5Qmizwyz2jW/BtPKtYMEfyR9dJUX1ZS4PyW7cv XRE6I35PKPk4NdtMwWZ972oOh3E4K9mgniAqvk53gONVn7Cc+LM+/UQXVqrxy74E7d8o NraA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IKrg3F2v; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y19si9579656eje.478.2020.08.25.08.45.00; Tue, 25 Aug 2020 08:45:23 -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=@kernel.org header.s=default header.b=IKrg3F2v; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726871AbgHYPoB (ORCPT + 99 others); Tue, 25 Aug 2020 11:44:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:58220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbgHYPoA (ORCPT ); Tue, 25 Aug 2020 11:44:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1EDA420782; Tue, 25 Aug 2020 15:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598370239; bh=DgFyxOdNOTi3TG94BiEuLcvBwr2/zo4bHO/PeqCjCx4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IKrg3F2vFQXnqAASePy/mMuLsPQW7IEiL+Xux1qbWn0qGtd1OeKAs6//mcqd5evcH FplyaJzVGuDTO1NiHzr441tAkqzWhwayfwfl5jDKAJkZMHemuEv0dp2dMbGVIreylT pochdB6GTVu2BLXiAolfJbfQGA4AiPxAdKQgbtQI= Date: Tue, 25 Aug 2020 17:44:15 +0200 From: Greg Kroah-Hartman To: Alan Stern Cc: Dmitry Vyukov , Himadri Pandya , David Miller , Jakub Kicinski , linux-kernel-mentees@lists.linuxfoundation.org, USB list , netdev , LKML , syzkaller-bugs Subject: Re: [PATCH] net: usb: Fix uninit-was-stored issue in asix_read_cmd() Message-ID: <20200825154415.GA1513396@kroah.com> References: <20200823082042.20816-1-himadrispandya@gmail.com> <20200823101924.GA3078429@kroah.com> <20200823105808.GB87391@kroah.com> <20200825065135.GA1316856@kroah.com> <20200825143946.GA365901@rowland.harvard.edu> <20200825144437.GA1484901@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200825144437.GA1484901@kroah.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 25, 2020 at 04:44:37PM +0200, Greg Kroah-Hartman wrote: > On Tue, Aug 25, 2020 at 10:39:46AM -0400, Alan Stern wrote: > > On Tue, Aug 25, 2020 at 08:51:35AM +0200, Greg Kroah-Hartman wrote: > > > At first glance, I think this can all be cleaned up, but it will take a > > > bit of tree-wide work. I agree, we need a "read this message and error > > > if the whole thing is not there", as well as a "send this message and > > > error if the whole thing was not sent", and also a way to handle > > > stack-provided data, which seems to be the primary reason subsystems > > > wrap this call (they want to make it easier on their drivers to use it.) > > > > > > Let me think about this in more detail, but maybe something like: > > > usb_control_msg_read() > > > usb_control_msg_send() > > > is a good first step (as the caller knows this) and stack provided data > > > would be allowed, and it would return an error if the whole message was > > > not read/sent properly. That way we can start converting everything > > > over to a sane, and checkable, api and remove a bunch of wrapper > > > functions as well. > > > > Suggestion: _read and _send are not a natural pair. Consider instead > > _read and _write. _recv and _send don't feel right either, because it > > both cases the host sends the control message -- the difference lies > > in who sends the data. > > Yes, naming is hard :) > > usb_control_read_msg() > usb_control_write_msg() > > feels good to me, let me try this out and see if it actually makes sense > to do this on a few in-usb-core files and various drivers... Turns out we have a long history of using snd/rcv for USB control messages: usb_rcvctrlpipe() usb_sndctrlpipe() so while _recv and _send might feel a bit "odd", it is what we are used to using, and when converting existing users, I can drop the pipe macro from the calls, turning something like: usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), ...); into: usb_control_send_msg(hdev, 0, ...); or maybe: usb_control_msg_send(hdev, 0, ...); with a full noun_verb pairing, instead of noun_verb_noun. thanks, greg k-h