Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp163926pxb; Fri, 8 Jan 2021 01:23:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlkP35TA0EfUmYAXvohgWma248/YQgcFW6NEngaOh2uN2HetS8kquRwf2t28rAgk5sabx2 X-Received: by 2002:a17:906:3bcd:: with SMTP id v13mr2057112ejf.181.1610097815661; Fri, 08 Jan 2021 01:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610097815; cv=none; d=google.com; s=arc-20160816; b=oSuRfuJF5YOAlCPbmnLZdu9n+j3JnuWPBByDvfxNpB8mAwjnnu5Ff5uCZWcpdqz+af 5V+MgYIVJ0GcDrFub5VqDHrrJo/E4qQEGwCakNtL/WmIz0GQfNorlQInDevRchhMIxg9 uW58P7QZGgnHm6Mdyxl2mLPmX8f1SJzz5CpO0J7hWEMHg11vQreDyaaHEucXuGLKWlnO GUE3rKjTsKDsHGt0nwHRx0/IuMhbkIBwzy2UFu2ayrMlJVZnRXMjU5Etm6x7FoFUpAMO iKxh6Omg0fccSLQq6PK169HvkdPVqcnovPUR+P+37XqrYatNBVu61hiopZOAa7QYMBpr 80MQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vicdA21qJNyUBcypS0yEUbFC+8pUMjes4zGIlrzMzoE=; b=LwstRlvlBtKeM2U7zo+s1HhPC95iVs8PBhsRZP4JJ/mdeeUbpI6xH8I71C4FXy6q7S oGvOnjM2tuZxuK6w+nZXbE/I/s/pFpoDyOIk7aw8tPrgDOMiYRBNzXSQdDgCed/+mGwa anmlS0m7YffQjH/p8N/VLpMpgZBRQS7ABkZtccG0MiYXA2QYjRAgVn73t6dyVGhTruG5 LtV/nr+meFMXi4RBNvLNwVrHeiSZiIgPn6ip4AQpsedbb2BACkEbKOemA4DAk33KZXYS rJSeFaTXcSIq7CmAhDsOEp+ATQXMtl+f+VQkGRMj2WMIbPskqMpbhsQ4PhDqD177AdZU cNbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FmG54POP; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb3si3373901ejb.126.2021.01.08.01.23.11; Fri, 08 Jan 2021 01:23:35 -0800 (PST) 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=k20201202 header.b=FmG54POP; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728095AbhAHJVK (ORCPT + 99 others); Fri, 8 Jan 2021 04:21:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:49738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727478AbhAHJVJ (ORCPT ); Fri, 8 Jan 2021 04:21:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 19BF323372; Fri, 8 Jan 2021 09:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610097628; bh=oiPKPwrLUTXmyxEg4htGUPgFpzc+ZSlNsGuIlmxZcHA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FmG54POPm2c2tiKdpWlDe940ivqmckLWEjMutD1Z9iWCYSH1oOGMajQcbIW3dJMec n9TFS+6rhKwqcvHge4pnOswKtWes6MxZUvil9oNN4hUhJyuCaofAqFpYXsdRw5Bjfy a7lkb0cRHVP+PxTQy62P2GE/d3k7oCBGoOFbXSRdjbzX9YcRRTZmhsLY/fdzw+pDMP HBtNNxb3lQEYayOFbkI7wAPEOuggq7xk3P2nSlM+c+P5n17w90rX9o5JJIUN8FE/KZ pzVGRvRLjOM4zY99FjwjvuyGp9rX8XwxhtEZmg3e5gL4IaT+QS0ONb9h/CXJOyxfo7 cUblV5M4jCQoQ== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1kxnwd-00019U-DK; Fri, 08 Jan 2021 10:20:31 +0100 Date: Fri, 8 Jan 2021 10:20:31 +0100 From: Johan Hovold To: Anant Thazhemadam Cc: Johan Hovold , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 05/15] usb: misc: emi26: update to use usb_control_msg_send() Message-ID: References: <20201130011819.2576481-1-anant.thazhemadam@gmail.com> <20201130012847.2579463-1-anant.thazhemadam@gmail.com> <6806f8e4-c2f7-3c6a-b855-3f87ab8d9e22@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6806f8e4-c2f7-3c6a-b855-3f87ab8d9e22@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 07, 2021 at 07:43:54PM +0530, Anant Thazhemadam wrote: > On 04/12/20 8:11 pm, Johan Hovold wrote: > > On Mon, Nov 30, 2020 at 06:58:47AM +0530, Anant Thazhemadam wrote: > >> The newer usb_control_msg_{send|recv}() API are an improvement on the > >> existing usb_control_msg() as it ensures that a short read/write is treated > >> as an error, > > Short writes have always been treated as an error. The new send helper > > only changes the return value from the transfer size to 0. > > > > And this driver never reads. > > > > Try to describe the motivation for changing this driver which is to > > avoid the explicit kmemdup(). > >> /* thanks to drivers/usb/serial/keyspan_pda.c code */ > >> @@ -77,11 +67,7 @@ static int emi26_load_firmware (struct usb_device *dev) > >> int err = -ENOMEM; > >> int i; > >> __u32 addr; /* Address to write */ > >> - __u8 *buf; > >> - > >> - buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); > >> - if (!buf) > >> - goto wraperr; > >> + __u8 buf[FW_LOAD_SIZE]; > > As the build bots reported, you must not put large structures like this > > on the stack. > > Understood.  > But I'm considering dropping this change (and the one proposed for > emi62) altogether in v3 - since these would end up requiring memory to > dynamically allocated twice for the same purpose. However, if you > still think the pros of updating this (and emi62) outweigh the cons, > please let me know, and I'll make sure to send in another version > fixing it. The redundant memdup() is already there for the firmware buffer and changing to usb_control_msg_send() will only make it slightly harder to get rid of that, if anyone would bother. But yeah, it's probably not worth switching usb_control_msg_send() for these drivers. Johan