Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4515828pxb; Tue, 25 Jan 2022 12:03:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0N/nYqOd3DrxkApuCfOgm5VG8xdCFjuhONztL4KikIaLt0MnLk52OXONf5Ntlnqv4qy3Z X-Received: by 2002:a17:907:7245:: with SMTP id ds5mr7110244ejc.417.1643141016926; Tue, 25 Jan 2022 12:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643141016; cv=none; d=google.com; s=arc-20160816; b=wHttJT/f0QZLwEQfGA3C8UxjUdVdOt14r/oU4O3dwR/qgJX8widV34uyFGOXk69ex6 jEW7eUvOuHQeJpQcIN5fSG9wXP4mDp0GLwVIcwtBQuxQMc03G127zOJjCQeew2JOasBl H3vrXy0aZ9oVk65Nubnfg4t7plabnRuFEcY7hJ7Tj/au6Z0kzy/oDSfAikcSHIw8Qbqn vMkMgE4bQgAjGw2SYyzwjindoj2PkA1VtCJGt+19NGlCv5xO5k3Ex56mG5o6zB02higJ jz3Al9GtQXD+RPPHVv5U8L1osqhGbtRokXR9ZXt0z1j2+nFN7f0AaQbVmRgRg+nCYAC3 DQXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=Rz6I6KvsbC3JmWn5u5HiUD6dpDAY3TCPycX+RIt0T+Q=; b=TTd/JXrXZlovRirweonF4TrbAsImohny+sdGh5DUiZcG1eJdXOWwXRRF229UFBje9d OEK2cvQ7Vlp0MC+nGwA0qdVDUHgm70TVj3IINZPYqcBNv6yB05m8ZngOmCfNEzeZJsIS gn52n8HI4XxrfSUPJ7LYHhYP2Kmd+/puT+4KC3dU2wVi0qBL71X06/Z4FO8irkheCZtr p2tbDFDGkxO3FnNyPdridyKQmFup1hS6tRzhq+3iimjx3oEubqmYmwnzYV2qOtVam5P5 P3X2eMj56oiEE1plgxCFBxgmlJhvdtLJvwNN3Y/ZgCCahcQc2tzQnGQqfTpw0+aSadVl uNxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ghgzhHxM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qw21si3605022ejc.478.2022.01.25.12.03.09; Tue, 25 Jan 2022 12:03:36 -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=@suse.de header.s=susede2_rsa header.b=ghgzhHxM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386648AbiAYOOw (ORCPT + 99 others); Tue, 25 Jan 2022 09:14:52 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:36692 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385445AbiAYOLx (ORCPT ); Tue, 25 Jan 2022 09:11:53 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E916E1F381; Tue, 25 Jan 2022 14:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643119910; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Rz6I6KvsbC3JmWn5u5HiUD6dpDAY3TCPycX+RIt0T+Q=; b=ghgzhHxMu1tPiPbtdJeYr8a2pdLL3mMziV+Nwc68coiiVOB7r/Jv58qZtMlU9/T0c6oaVt w8fYuYD9YYBpA94gk2GjaCFeRHU2y8c7ozH8bh7wm/a5unrFe6gI73xfKaE+88WVxFbpXN BIpPpe7YE5yJFFU3YblQcRX7wFJWmpk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643119910; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Rz6I6KvsbC3JmWn5u5HiUD6dpDAY3TCPycX+RIt0T+Q=; b=ULvJZ3taZUVAIUUVzlJqZodE6YiS/D8iIIb+yITXZ45PFf/6JUVzvdoYA2nWCNWm8kCwJk Xrxx+6CBr8rkVZCg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id F2834A3B84; Tue, 25 Jan 2022 14:11:48 +0000 (UTC) Date: Tue, 25 Jan 2022 15:11:48 +0100 Message-ID: From: Takashi Iwai To: "Gustavo A. R. Silva" Cc: "Geoffrey D. Bennett" , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2][next] ALSA: usb-audio: scarlett2: Use struct_size() helper in scarlett2_usb() In-Reply-To: <20220120211600.GA28841@embeddedor> References: <20220120211600.GA28841@embeddedor> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Jan 2022 22:16:00 +0100, Gustavo A. R. Silva wrote: > > Make use of the struct_size() helper instead of an open-coded version, > in order to avoid any potential type mistakes or integer overflows that, > in the worst scenario, could lead to heap overflows. > > Also, address the following sparse warnings: > sound/usb/mixer_scarlett_gen2.c:1064:28: warning: using sizeof on a flexible structure > sound/usb/mixer_scarlett_gen2.c:1065:29: warning: using sizeof on a flexible structure > > Link: https://github.com/KSPP/linux/issues/174 > Signed-off-by: Gustavo A. R. Silva > --- > Changes in v2: > - Use correct format specifier %zu for type size_t argument. Applied now. Thanks. Takashi