Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1279374rdb; Mon, 2 Oct 2023 05:07:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQF8M/7HSti1VKaQhsLzoT7s01n6C1ITXbqBG3U5U+vYvLpULdGPSY3yu0Yrk+VWAtK2/2 X-Received: by 2002:a05:6a21:6d96:b0:15a:3eaa:b7f8 with SMTP id wl22-20020a056a216d9600b0015a3eaab7f8mr14138670pzb.50.1696248457168; Mon, 02 Oct 2023 05:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696248457; cv=none; d=google.com; s=arc-20160816; b=s/kPqiuqAqC/nWv+vrDamtgQAJ/gpNleesQmZKwkWEsvwR5tqQMQmU5v179+J00EIn /sTTX9Cka9qtalCEACT2v5fOPif6qf4m2KrIG614uSfW/owo4bZEQxWCkP2MpesU+/br CMdaCKhvdLUI0VHkRjESfrySPe38gfbb1gQOBxcc6d+IMOtAz9XS4Sg75RacA7GJr1pg txxL1+fgRppMfPkp3SF20H1none8QFQGd0sN+w77goyavCH8HxXEGANQEadTmiPWkr6V FVtvGBuyLatSoJ30UJRLXUwre5FNrUIw0a69au6UYFpjS0RCJeBT+Kekq1ynM+R1NIp8 o8Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=o8TgiYq+wn9fPs2sstUM34/3tbN8lpchGjTxpN3osFc=; fh=vzI13+Le9X4g6qIpJSxvbVRKWcrur6qfGmlImdnjChE=; b=KuMPPTFelQVyaRXDr6gUd0c3Sruhvl4p76BJb6xacO6le9+lXnB4Pj/qRtCxE1EYAX FcEjwa+zqxPksuJEQV+8Uwp337wIx8pJU5GykOs7PNxXjhvD+bXNABwucDgljpcWQurt iFcR5c8IZniOuyhU6Ht///F1Bl7HsFQ8I4VYABgXqae5p3ffkUh2P8Awkj5fqfhqWA5D cCc13SnuhLW6QOFb17bWOzAJL+yaCn+pzWI4/We5he4HBtr4HClQXzMIwfRKTShxaSSp N9qu4HbZpzkTV2/lPO/uD0ep3HRmTcjKCv3LRWjCGh43/RA7sBDUpj487dr9hfQAy6Hf 6CqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EYcTIe1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id fa25-20020a056a002d1900b00690ce34a02bsi29362852pfb.224.2023.10.02.05.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 05:07:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EYcTIe1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7362E80845AD; Mon, 2 Oct 2023 00:36:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235783AbjJBHgk (ORCPT + 99 others); Mon, 2 Oct 2023 03:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235750AbjJBHgh (ORCPT ); Mon, 2 Oct 2023 03:36:37 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B918D7 for ; Mon, 2 Oct 2023 00:36:34 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-51b4ef5378bso12645415a12.1 for ; Mon, 02 Oct 2023 00:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696232193; x=1696836993; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=o8TgiYq+wn9fPs2sstUM34/3tbN8lpchGjTxpN3osFc=; b=EYcTIe1rA5iMT9Eckl75edHfhjI2D9SUeW2wCe3HFLYHXWuxwOgTZgpt6Z4iwjUTES s4ersIvJVc++7TZ+J8kJOkFvuOqa2DRihG/rYeoatuYKdMDtbiepbwDoOryk6a6nn9m3 y9uwYMVUPlfjSUYEdwLj2h09wNwEfTgEIFC/A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696232193; x=1696836993; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o8TgiYq+wn9fPs2sstUM34/3tbN8lpchGjTxpN3osFc=; b=GSkyT+o+4XlrHCVJw4RwRvxc2jr0h1Tus8bKv5+gpbew89GTw2WtugQLr2dVcl2V2G VwSyPL0Hz77VRf+XY4kUKeg3d6QDJJzASSOOaEWyUY+ZYqg/NUAXO3ZNF3SXosBRXH9j xJQf3RHBhlXEQIWjXO6q81t0PfbtSebEfSc48mr0YkIn/wm4oBH4YXTJ4yi1HDlY0faR ejwyuUKLUwHm2SA0xuLqrvNzHjjdkI2t2+CHvBt+QMogmlOXb0Zp7N6GtUv8OAgpFHYk iRoGcb7lP4a49gm2CPo6IqVmPj21qphZMkVFfyRtir4GPddq1r6zV74vueoRDR4q4One A3Mg== X-Gm-Message-State: AOJu0Yy4dtUVG8kPgsxQC2BZRHgFWZTWwOUAsET5Cu8zjUgnguXSyIWa K/aZU5iQFqu6LoofVbhZ/Xh9Dg== X-Received: by 2002:a17:90b:3644:b0:277:1bd8:abe8 with SMTP id nh4-20020a17090b364400b002771bd8abe8mr9560405pjb.18.1696232193693; Mon, 02 Oct 2023 00:36:33 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id 6-20020a17090a194600b00278eb908f78sm6274500pjh.19.2023.10.02.00.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 00:36:33 -0700 (PDT) Date: Mon, 2 Oct 2023 00:36:28 -0700 From: Kees Cook To: Julia Lawall Cc: Kees Cook , Christophe JAILLET , Ian Abbott , H Hartley Sweeten , "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] comedi: Annotate struct comedi_lrange with __counted_by Message-ID: <202310020036.864B735D60@keescook> References: <5c3b7459b820e22e2ac6ce892d4aadcc119cc919.1696065263.git.christophe.jaillet@wanadoo.fr> <202309301342.5B5BED40A1@keescook> <90E2BBA5-8A2D-42DE-B36A-CD37BABBB433@kernel.org> <202310011405.7599BA9@keescook> <202310011421.C4F19D45@keescook> <202310011515.D4C9184@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 00:36:49 -0700 (PDT) On Mon, Oct 02, 2023 at 07:38:42AM +0200, Julia Lawall wrote: > The sizeof with an expression argument is treated differently than the > sizeof with a type argument. So you need to write: > > @allocated@ > identifier STRUCT, ARRAY; > expression COUNT; > struct STRUCT *PTR; > identifier ALLOC; > type ELEMENT_TYPE; > @@ > > PTR = ALLOC(..., \(sizeof(*PTR)\|sizeof(struct STRUCT)\) + > COUNT * \(sizeof(*PTR->ARRAY)\|sizeof(PTR->ARRAY[0])\|sizeof(ELEMENT_TYPE)\), ...); Ah! Thank you thank you! Yes, this works great now. :) -- Kees Cook