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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8962C433F5 for ; Wed, 16 Feb 2022 20:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231636AbiBPUgE (ORCPT ); Wed, 16 Feb 2022 15:36:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232574AbiBPUfp (ORCPT ); Wed, 16 Feb 2022 15:35:45 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32B6B2AE729 for ; Wed, 16 Feb 2022 12:35:32 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id t14-20020a17090a3e4e00b001b8f6032d96so3489323pjm.2 for ; Wed, 16 Feb 2022 12:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=ZiuFSTUba1ATIIXLsTWrQztSTfw4EGm3xQIUgvLL4Mk=; b=YXjfl7xGUMOFGqUfuV8g8dqmpsyREkxR2ZgdxcoP9kPzp2YmCd3cfWw9AYwPKinBnf gcJwe5aFs2j51u2c3EReqPEpZ2SfOf7qXc4tnTxvI2sZZl4qjbFKLZZz/kztyyRitwg8 YzpybCwUVrhXH9Z5tsATr5UR9Cv23DeMtqssk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=ZiuFSTUba1ATIIXLsTWrQztSTfw4EGm3xQIUgvLL4Mk=; b=WPAfCZWrrp+2k5XLWPIQNv8go7tD9cajLSKCUxfJTeOOIRjcqgrK50J+Dsgzdz2uJj hdCM5rHmmEztdqlfNEEobha3oJ69cCZFSNFAljIVsg1VUPCdEjVrzZvZzPH1U7DweAPE 0Y0o4t+8J6/Tp1VhOvdN+Xocp2kpY20u9HGQ3d0qYXD+jJgKWdY8miMQQVOz7PAbUrat ZgniveX4JzARC63V+r9LXDhEc0/DikHVbX9dB+3GHRcDriQ6PJE/2u61i5cb7Vjwp/LK g8f8yILHIj9g+v+3zYnxNMXhIrly6P/XLUWRv84cJP1BHDtlOaOnaGPnhFA1AlI7rMvv gM5A== X-Gm-Message-State: AOAM531nhvL6mqxWxCNyQBcoTWSxjdYphkavpMRciykAQHPX357NWeWY 9MjQS6833c4JaRKYzYX190fSAczZMqM0Ng== X-Google-Smtp-Source: ABdhPJwwN7eFoWkSBD6A2li7xRKGQqNGXljyJPz1+jlWuOdkrFtGLad3asl8gm9epTBPDnceOx4M1A== X-Received: by 2002:a17:903:281:b0:14c:f3b3:209b with SMTP id j1-20020a170903028100b0014cf3b3209bmr4129964plr.87.1645043731720; Wed, 16 Feb 2022 12:35:31 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d15sm44055299pfu.127.2022.02.16.12.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 12:35:31 -0800 (PST) Date: Wed, 16 Feb 2022 12:35:30 -0800 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Ping-Ke Shih , Kalle Valo , "David S. Miller" , Jakub Kicinski , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] tw89: core.h: Replace zero-length array with flexible-array member Message-ID: <202202161235.0C91ED227@keescook> References: <20220216195047.GA904198@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220216195047.GA904198@embeddedor> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 16, 2022 at 01:50:47PM -0600, 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]. > > [1] https://en.wikipedia.org/wiki/Flexible_array_member > [2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays > > Link: https://github.com/KSPP/linux/issues/78 > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -- Kees Cook