Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp681219lqh; Thu, 28 Mar 2024 12:59:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXNkPLu3Eqn2wWwAcW7gAf5xgptZT8A2mn/WFoY4c+0Ng5RvXxd0FbErql1zOmkHkRGtvcq9OegrEzSwAtAIYm37h/va+UUc17KvygQg== X-Google-Smtp-Source: AGHT+IGwpFbZPAEGKQRvpEKkFISPjClLOtTB3mOOB/wTRbY2neMzT9acUU95lvM6KiRnPxsiHgcB X-Received: by 2002:a05:6358:3396:b0:183:6537:8771 with SMTP id i22-20020a056358339600b0018365378771mr429689rwd.23.1711655947118; Thu, 28 Mar 2024 12:59:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711655947; cv=pass; d=google.com; s=arc-20160816; b=E5M8JhepCKz21EuBHQ/7pn1YDyfX5119qWXUQpYDm4AT7wOaGyuaazQ3smuM+FBDJe vFXHPX4i7UbcDq3c6S1H8SutaY0QV+zh3aPhm6sO2YmSnWaeQgMn5o7nmbfWWE/jFggd kofZDTg6cN7V3ICZn0PuSZDzKBkEMav2craYn9hvjSMpS+JxIwvpi78CwvByJ+ezfw3R FsyX94OvuRWm3ScOCQZoMvUH9UHH81IbJX3N7VjZz0GzEXUbjFaNP/7gGZFk6McK9iy2 PlwRJeGrSxS1olKCHb34mdisbQ3d0udSuGMpXTf9NGWdEAwFlZJWUvvzFQs/Xohn87Ex SGQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nJnwU1+gGS+NGNA2zseGcZeJ5QG2IPGlkTTsQ5KCHlw=; fh=9Ft3xC79e9IHqjHRF+zTZ9DVTjUTHtQUoD6v7NQnpls=; b=IhIvH/21EFHfchflj0mC9tAuBruZ8hI8iJl3DqtMbj7bZGwfb4EvD8uaiTDh7uGTnC le8h2n6wR1D5FiqxnZIQoTnK3PEfO/p8wbrNR3k9a43RaK0Ew4BvenUQta+UhVEb5jwM vGFS1r8Zy49XGij+X+szdEgWLugKnNyS+vZdWm/PgDFoBTCdyckd4Zs7MRTuaM82U3f8 c8IJZXbP2zanM72b+S7vUN0fApEbmuXsDlH0mMO+l1fmEZui9kiZu+HfHcabPBGsmAHu pKtCFuJ+uo7OBhgnIkrvXM6CFUDxEKV3OLIc2kuq2rGkcZ/q7erteycdxvyUGxsRL16g /TZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=kSsq3Ssw; arc=pass (i=1 spf=pass spfdomain=amazon.co.jp dkim=pass dkdomain=amazon.com dmarc=pass fromdomain=amazon.com); spf=pass (google.com: domain of linux-kernel+bounces-123504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a71-20020a63904a000000b005dc8a59e303si1977800pge.111.2024.03.28.12.59.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 12:59:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=kSsq3Ssw; arc=pass (i=1 spf=pass spfdomain=amazon.co.jp dkim=pass dkdomain=amazon.com dmarc=pass fromdomain=amazon.com); spf=pass (google.com: domain of linux-kernel+bounces-123504-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EBF2C29D557 for ; Thu, 28 Mar 2024 19:50:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85CD913A3ED; Thu, 28 Mar 2024 19:50:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="kSsq3Ssw" Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E48F13957C; Thu, 28 Mar 2024 19:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=72.21.196.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711655406; cv=none; b=C2ZKThbQY0sbskjF85FLhOcCLFjW+MeI4k2t9p7CUyCVvA7Fwr6hIZ40yLOxxpOvBXn4Ewh/oZ06sBf3Sg7tmby00JeJpDb54qwebAkoBvnRIA8O/ac8cb+tKI5Xm7wIsoJdYQcYbE9RhMwklBYf5V3jYslxbeqgCg7xm8v/CZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711655406; c=relaxed/simple; bh=jy7iDHuc6Ej+2jTP9CC2GUNMdvWMnjZbOjyyWldjqgM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pGlWSCU3hewS85fa+0fXK3PiWedXt3sC0SwKVMFgoa/xq/WNN6+LnunaADVYf/SVA1126JpvS5xxwZ8jdDxu0oETekzJTS8d1U0nja60g2HUHO323OOi0gQfRWWHsb+qggCs8wY0LTe9f8bJqhiO9mxfp0Aqf31j/3E4CI0JwqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.jp; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=kSsq3Ssw; arc=none smtp.client-ip=72.21.196.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.jp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1711655404; x=1743191404; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nJnwU1+gGS+NGNA2zseGcZeJ5QG2IPGlkTTsQ5KCHlw=; b=kSsq3SswdfM+s5M8UqDDX85q+IN/9e+Z567+yJm/QP1kNGJtNRgrVEbl odpo0TI25iXqMG4FHEkylvhcNAI6R2yWFlh9tcBfJJxN+t0/yvVjL+97g tZFDglExU6sH72SoJanz1znpLauXX5knwVJVaV+VuU3Cxnnl9Os8Q5cbG c=; X-IronPort-AV: E=Sophos;i="6.07,162,1708387200"; d="scan'208";a="391312047" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.43.8.6]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2024 19:49:56 +0000 Received: from EX19MTAUWB001.ant.amazon.com [10.0.21.151:20037] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.47.83:2525] with esmtp (Farcaster) id 73cfa33f-945b-445c-ba15-2d07ca3a8590; Thu, 28 Mar 2024 19:49:56 +0000 (UTC) X-Farcaster-Flow-ID: 73cfa33f-945b-445c-ba15-2d07ca3a8590 Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWB001.ant.amazon.com (10.250.64.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 28 Mar 2024 19:49:56 +0000 Received: from 88665a182662.ant.amazon.com.com (10.106.101.27) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.28; Thu, 28 Mar 2024 19:49:44 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 4/4] ax.25: Remove the now superfluous sentinel elements from ctl_table array Date: Thu, 28 Mar 2024 12:49:34 -0700 Message-ID: <20240328194934.42278-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240328-jag-sysctl_remset_net-v2-4-52c9fad9a1af@samsung.com> References: <20240328-jag-sysctl_remset_net-v2-4-52c9fad9a1af@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D037UWC001.ant.amazon.com (10.13.139.197) To EX19D004ANA001.ant.amazon.com (10.37.240.138) From: Joel Granados via B4 Relay Date: Thu, 28 Mar 2024 16:40:05 +0100 > This commit comes at the tail end of a greater effort to remove the > empty elements at the end of the ctl_table arrays (sentinels) which will > reduce the overall build time size of the kernel and run time memory > bloat by ~64 bytes per sentinel (further information Link : > https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/) > > When we remove the sentinel from ax25_param_table a buffer overflow > shows its ugly head. The sentinel's data element used to be changed when > CONFIG_AX25_DAMA_SLAVE was not defined. I think it's better to define the relation explicitly between the enum and sysctl table by BUILD_BUG_ON() in ax25_register_dev_sysctl() BUILD_BUG_ON(AX25_MAX_VALUES != ARRAY_SIZE(ax25_param_table)); and guard AX25_VALUES_DS_TIMEOUT with #ifdef CONFIG_AX25_DAMA_SLAVE as done for other enum. > This did not have any adverse > effects as we still stopped on the sentinel because of its null > procname. But now that we do not have the sentinel element, we are > careful to check ax25_param_table's size. > > Signed-off-by: Joel Granados > --- > net/ax25/sysctl_net_ax25.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c > index db66e11e7fe8..e55be8817a1e 100644 > --- a/net/ax25/sysctl_net_ax25.c > +++ b/net/ax25/sysctl_net_ax25.c > @@ -141,8 +141,6 @@ static const struct ctl_table ax25_param_table[] = { > .extra2 = &max_ds_timeout > }, > #endif > - > - { } /* that's all, folks! */ > }; > > int ax25_register_dev_sysctl(ax25_dev *ax25_dev) > @@ -155,7 +153,7 @@ int ax25_register_dev_sysctl(ax25_dev *ax25_dev) > if (!table) > return -ENOMEM; > > - for (k = 0; k < AX25_MAX_VALUES; k++) > + for (k = 0; k < AX25_MAX_VALUES && k < ARRAY_SIZE(ax25_param_table); k++) > table[k].data = &ax25_dev->values[k]; > > snprintf(path, sizeof(path), "net/ax25/%s", ax25_dev->dev->name); > > -- > 2.43.0