Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1297684pxu; Sat, 5 Dec 2020 10:34:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqCdrd4PZMUP0yeNxiaVKAI0v4uFS1T4mbnAagBB5PmpFAVc1f+ZTEMfiW4aAAeZM99yM/ X-Received: by 2002:a17:906:ce3c:: with SMTP id sd28mr12296271ejb.485.1607193277798; Sat, 05 Dec 2020 10:34:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607193277; cv=none; d=google.com; s=arc-20160816; b=Ngz9oOw9gdwNglOQm3aiGA2331XWxDZsgMWNhErd08bcRJMK2P6E72kecdsiQTQaNT 4J5TjHXa2Y2zjh8zTkGnkiYbpOXsRXvpiQGGSlbx/OUyzdHInEc88o8q80b/nJCGMPbG HqdsOckGH7WI98JtXNLKiB8vRGGWprw9C2t+KQKxVgEFFdSDTKmaNP5ZMXl1ocxcmaPR +hqmLuUBaYGzOFiZNdpb0MEL3K1mhVOBseMYCwyIdJceTS5EokJEKo7A87b+AzGKekYh xh3/fZRzdsYYtouRhEwEbC5AUxBwwoRqmbeQhSikxMhgvLE6h4y/s9lvlqpansd82ll7 +bkQ== 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=3TlwooxgRwoGhIAqrEvGuhsnyngjkFdmWKaLWKUAcyY=; b=wgAzOJ1sNiaZ+fyxn4LwUvET298nqQ53+vCK/ZjoQSDpsedD3rOFMACQlSOH/PfY+h IZ4zg/Ywsty7viDD/2E9jsR2ra2TP25TKJi8kfEez65HoPEjVeSySyoOJxV6Tgf0ag5l 87GC+McsT9Oh4DMzKDU6H64B3uqz4h+w6EdNp+cyxZKCh36iLlC4q4dnOCG97NWPqlOm Ca9egZPQ4ZeU8RQGQ8Iu47Wg9yY74/Ydc8fIQeJEEo2NCm8S9NXNGjPqVj8FeDFIVlGQ hqHFHWAULyApC7jW5G2OwuD6zf+yiVirve2f3llmzoq+1o+AqfsZrOGc3DWpK4+jwjd+ FKgA== 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 hq6si3774039ejc.40.2020.12.05.10.34.14; Sat, 05 Dec 2020 10:34:37 -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 S1730309AbgLEST6 (ORCPT + 99 others); Sat, 5 Dec 2020 13:19:58 -0500 Received: from netrider.rowland.org ([192.131.102.5]:55771 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728247AbgLESCy (ORCPT ); Sat, 5 Dec 2020 13:02:54 -0500 Received: (qmail 1179704 invoked by uid 1000); 5 Dec 2020 10:15:11 -0500 Date: Sat, 5 Dec 2020 10:15:11 -0500 From: Alan Stern To: Minh =?iso-8859-1?B?Qvlp?= Quang 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: <20201205151511.GA1179536@rowland.harvard.edu> References: <1607063090-3426-1-git-send-email-minhquangbui99@gmail.com> <20201204161249.GA1141609@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > In my opinion, there is no difference in speed between 2 ways. > When I compile this array initialization using gcc 5.4.0, this > initialization becomes > mov instructions when MAX_NUM_UDC=2 and becomes rep stos when > MAX_NUM_UDC=32. I think it makes no difference when comparing with memset() > > Thanks, > Quang Minh