Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1814379pxu; Sun, 6 Dec 2020 08:12:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQgO0xJee2ZSCEQa6Un5EBAc8E0CqfV9SCwAXi9mkwsW5sFBJXq5shu5eYfeymGgLXCuFL X-Received: by 2002:aa7:d297:: with SMTP id w23mr16483709edq.374.1607271134128; Sun, 06 Dec 2020 08:12:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607271134; cv=none; d=google.com; s=arc-20160816; b=l2iTJWWKAufs9ydQAaCQsYq+V6c5ZwWcC4atDTKVHNbmbYNFO951ce3O9eD8uyEEB7 7M8bkvlG6oGY3ViSjAd+fPAfbsBZwSkqFaqQ6QjygMGYTS3Hbdjz29/yPRqapV5OtNqY lr4w7VH2t439CJ0o3JGFQ67KIx8bPxRTcMm1TOQmKadC6U/hKSeE/7FwNaoDDrstuW3J +N4R0XpaEgPxAMgWx6sUbgWLtW2fAC5AuXSF8RNUoABoSoj4DkHHBb9bh/Jm97XOOc15 ajIeddjNaNCAzuYiJyMHKwoqyrQ6VL+gPFlEK0lrIFTOt61px6U6MmlA9MPoeBeSE2ax 7PaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fRQuK/X//UE1qIKZ9pPkSdzPuq1gvdFPlVKSn4osZxM=; b=bIGubfULLszl0OIIUmvLOhDM955g2y6Smb1v+/WFb29vZgdI7lAO/uLvoccP+ThgCg JCUcauuKe4TOkvjCsZjF5A/8xGYwjXj2cAczmCDdB/uwIrU+yrxLB+4yVhRHQFs41fqz giVGBBOprBm2HbaO1gaO0Bjv6j77L9Qjd+pZhuxiQbRrwX6Occ4uwlgPdxtW+kPzJZun 5neGBMOeqVSCN9nlkbx/eNRTPc5TM6HeLO1o6x9wGeryG8yef2L6I0WWxa7HL4qwI7PW EDTSIDnt4dlRIYH9wTImAaI5NDlrKQFdk3wBranvkIEO8qwDNFJes9JD/htPEQDCGW4F u61g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nq7si5130189ejb.109.2020.12.06.08.11.50; Sun, 06 Dec 2020 08:12:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726832AbgLFQHv (ORCPT + 99 others); Sun, 6 Dec 2020 11:07:51 -0500 Received: from netrider.rowland.org ([192.131.102.5]:54057 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726547AbgLFQHv (ORCPT ); Sun, 6 Dec 2020 11:07:51 -0500 Received: (qmail 1213044 invoked by uid 1000); 6 Dec 2020 11:07:09 -0500 Date: Sun, 6 Dec 2020 11:07:09 -0500 From: Alan Stern To: Bui Quang Minh Cc: Felipe Balbi , Greg Kroah-Hartman , Corentin Labbe , Jules Irenge , Andrey Konovalov , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: dummy-hcd: Fix uninitialized array use in init() Message-ID: <20201206160709.GA1212872@rowland.harvard.edu> References: <1607063090-3426-1-git-send-email-minhquangbui99@gmail.com> <20201204161249.GA1141609@rowland.harvard.edu> <20201205151511.GA1179536@rowland.harvard.edu> <20201206112405.GB3006@minh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201206112405.GB3006@minh> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 06, 2020 at 06:24:05PM +0700, Bui Quang Minh wrote: > On Sat, Dec 05, 2020 at 10:15:11AM -0500, Alan Stern wrote: > > On Sat, Dec 05, 2020 at 07:47:01PM +0700, Minh Bùi Quang wrote: > > > Vào Th 6, 4 thg 12, 2020 vào lúc 23:12 Alan Stern > > > đã viết: > > > > Does this initialization end up using less memory than an explicit > > > > memset() call? > > > > > > You mean speed? > > > > No, I mean memory space. > > > > A memset call requires a certain amount of instruction space (to push > > the arguments and make the call) but no static data space. > > Initialization requires some instruction space (to copy the data) and > > static data space as well (to hold the data that is to be copied). > > > > Alan Stern > > > > Thank you for your clarification, I didn't think about it before. > > As I check when compiling the code, with MAX_NUM_UDC=32 the initialization > becomes > > xor eax,eax > mov ecx,0x40 > rep stos DWORD PTR es:[rdi],eax > > With MAX_NUM_UDC=2, the initialization becomes > > mov QWORD PTR [rbp-0x30],0x0 > mov QWORD PTR [rbp-0x28],0x0 > > As I see, initialization does not require additional static data space. > Am I right? Ah, okay, good. I didn't realize the compiler was smart enough to do this. Thanks for checking. Alan Stern