Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3800467pxk; Tue, 29 Sep 2020 06:39:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmXYmLhrXcRS43w/s3POrEIdLqfgeDHZpArCHMzx4IdpzIx8faufugDoWWZnN/Zh+MZnrq X-Received: by 2002:a05:6402:696:: with SMTP id f22mr3239712edy.290.1601386781535; Tue, 29 Sep 2020 06:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601386781; cv=none; d=google.com; s=arc-20160816; b=WUNoWLVWmwFVB4QmCzE8QJEdhMQe3QNtAygZ0VfXD5Kj7je5esq0KFaoFE8LXeNMgq XNSyFwmObl96uJP9DCubiNjZqgT35KpI+g2p0lKCqi6r1elBCoiHWf7kAv8ZT6zVBPss oUWsyxA04hIS1do6LE6dSMzmCppxai1CT+peSgb2Nn/VV6KGlPte6ipittMylwDOGewV gkZK0bvPEMFwRYjT+Ep2muq8aY3PLuduP5bnSa214AwhnW43kympHCvqMJZKmJ6PltTn JxSwc3CH2T/lZnSewWQIyON074it6YwTKgln9YE1EYHvdadm7YKryO2nuMOt+k7hRa4M 8gww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:dkim-signature; bh=gYyfNaGONmQJwfnhQolI8j3x4GD8hEtq2ZLedtUuZwU=; b=eiwW88VJZeOnNCetHOyCPFJ7XOCuaBc9EnIxLC/0dNhSZ1/D191nJU1foVOkju/dIZ zxBQWqznNJH9BQamatxbZIxvISlTNw+DVod+7YbQlD5UWYHH1f8G1anA5qkRpb2TEkxO I2UpDj26sKgZsstaKLfKZOZZ2Y9OaKUD7iW/EbO853eoHcV+pjlGj/vgsPfQJrcDmlWt 2XnHuhwCr7/eKGyYdyOQHFH0n1OAwkDhRQTEoUHl5o405BgFvkHJWMeG/+ipZc6cvZEi 2yjkHnAX1ZojCEHCipkTQoFgeuLWUXkt+r5ms6ZkhoWE2gWIJ+ITATh2hrdXJI8J0Wdt GZtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T1W2FuM5; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si3026236ejx.443.2020.09.29.06.39.17; Tue, 29 Sep 2020 06:39:41 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=T1W2FuM5; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729098AbgI2NiP (ORCPT + 99 others); Tue, 29 Sep 2020 09:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgI2NiP (ORCPT ); Tue, 29 Sep 2020 09:38:15 -0400 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AD64C061755; Tue, 29 Sep 2020 06:38:15 -0700 (PDT) Received: by mail-oi1-x243.google.com with SMTP id c13so5450758oiy.6; Tue, 29 Sep 2020 06:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=gYyfNaGONmQJwfnhQolI8j3x4GD8hEtq2ZLedtUuZwU=; b=T1W2FuM5KTRjw8r3HYNG9gpRyTB5Z+K7PceumkjtMxh/YOfgRxXACAIaDOm1rxkRIs ZLCgYbNlHZmIpM5WiO+DwHZQHIMQB4/4srJoZsYFAWc2nJtVz4NuUwzLiquu9QQxS6PJ TdqOrJGaZiKubM+C9xgY+O+iHrbzKsr0z9+7dUCceLY3wcx+QnaQNugJ0rfHkAmV2nYb p+lu9Mcs3hZx7Mf5yN8NCPyUAnVj5r+5umgV6O+sgkdc57gixhKzY3DxcPJNNa9N1G+p TR9d1K/W2xn1chF1RE2l4TOVRqcRhuClzlocB0JnAzJuYiJvQfkvf86ybawpd56ObQCN 5G6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=gYyfNaGONmQJwfnhQolI8j3x4GD8hEtq2ZLedtUuZwU=; b=IRPP8vxgH6Jqn0MU3AG2WeQ9V/UpZtfyWEYxYRGTdEL2LseRr3HreC8X3wJpfz25qr m8vCjqlBFjIMZm2vJ4+9wtvYdiGlwFqUwPuVq0TnYBAIJZiv32bWZlHK3OnGSxX3T3C/ hqstE/N8+VO0hyb3WVh5IXj8ItziN/Dtze0CQI2Jg6bHb1sSWN7osmAG9NQKdIKe5Zpo qziJ2xjaABvzpm2QB1wDrRdCspSfkviZBVwc+c8ivlb7Lv7SuepNPByT0uVZhddSYJR+ 8RNCyCO71McnbuiuwbTukpBOAu7qLZqaz7wtuHMhxJhbbRPNSrGCEmGXddIzmvyhhGnG vd6g== X-Gm-Message-State: AOAM533V+9XLB5ua7E9cSic/EkYkyFRz3zNKhTDiY9C8mhq7nPB9xs5o oO4T0QZTENtl9B9GKr9npiOJ0bJ/sfGd5ZyCOjTvgweS X-Received: by 2002:aca:2301:: with SMTP id e1mr2712001oie.177.1601386694388; Tue, 29 Sep 2020 06:38:14 -0700 (PDT) MIME-Version: 1.0 References: <20200910211344.3562-1-colomar.6.4.3@gmail.com> <20200910211344.3562-13-colomar.6.4.3@gmail.com> <7dd2ab72-3ce7-1f50-229a-e663c3df2dcd@gmail.com> In-Reply-To: <7dd2ab72-3ce7-1f50-229a-e663c3df2dcd@gmail.com> Reply-To: mtk.manpages@gmail.com From: "Michael Kerrisk (man-pages)" Date: Tue, 29 Sep 2020 15:38:03 +0200 Message-ID: Subject: Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name) To: Alejandro Colomar Cc: Stefan Puiu , lnx-man , lkml Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 2.- Use sizeof() everywhere, and the macro for the initializer. > > pros: > - It is valid as long as the buffer is an array. > cons: > - If the code gets into a function, and the buffer is then a pointer, > it will definitively produce a silent bug. Sigh! I just did exactly the last point in a test program I've been writing... M