From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57B55C433EF for ; Thu, 30 Sep 2021 11:48:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41AAE615A2 for ; Thu, 30 Sep 2021 11:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350584AbhI3LuA (ORCPT ); Thu, 30 Sep 2021 07:50:00 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58050 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350490AbhI3Lt7 (ORCPT ); Thu, 30 Sep 2021 07:49:59 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id F2C7A2247F; Thu, 30 Sep 2021 11:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1633002496; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ODCAoKormRMtsWMKmm9fOWai9zDZSbllUaXvae+Mu9A=; b=Q5XUM5/8K8nVicS+NqiAuTRhwfflSUGx82yCKJOFw3KAB8txn61CdplSvuiNUhbsEHjenK X0ZVOqLAdK5H/Hiv87KmPH7r5Qf91pHjM+M80TabVHhjuV/Hdus6XvUUMXMQt/Fza3vIUI laz22shLmoeHBy50vnbXrzgs1nh74Z4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1633002496; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ODCAoKormRMtsWMKmm9fOWai9zDZSbllUaXvae+Mu9A=; b=HJC7FgSzY9LlldTNKeChZ0JmUqI1pfI3d4ZSSGpzRuA1aRBC55Mrr8CLDNs5eGKwciAc2L 7/C7CtHnLrhDY2AQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id E9FDBA3B93; Thu, 30 Sep 2021 11:48:15 +0000 (UTC) Date: Thu, 30 Sep 2021 13:48:15 +0200 Message-ID: From: Takashi Iwai To: "Gustavo A. R. Silva" Cc: Anton Yakovlev , "Michael S. Tsirkin" , Jaroslav Kysela , Takashi Iwai , virtualization@lists.linux-foundation.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] ALSA: virtio: Replace zero-length array with flexible-array member In-Reply-To: <20210929191504.GA337268@embeddedor> References: <20210929191504.GA337268@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=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 29 Sep 2021 21:15:04 +0200, Gustavo A. R. Silva wrote: > > There is a regular need in the kernel to provide a way to declare > having a dynamically sized set of trailing elements in a structure. > Kernel code should always use “flexible array members”[1] for these > cases. The older style of one-element or zero-length arrays should > no longer be used[2]. > > Also, make use of the struct_size() helper in kzalloc(). > > [1] https://en.wikipedia.org/wiki/Flexible_array_member > [2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays > > Link: https://github.com/KSPP/linux/issues/78 > Signed-off-by: Gustavo A. R. Silva Thanks, applied. Takashi