Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp936649rwb; Tue, 27 Sep 2022 06:32:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM409AKW/vD1mlpN/JAxp5ES7dsuephZu7Xf5ZoZoFluWzErBuA4lF1RBGOebVurECYYjvA5 X-Received: by 2002:a17:907:60c7:b0:783:4fe0:dad0 with SMTP id hv7-20020a17090760c700b007834fe0dad0mr10571749ejc.342.1664285547161; Tue, 27 Sep 2022 06:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664285547; cv=none; d=google.com; s=arc-20160816; b=l1VbLg/TaGAPd1YOZbjRW2Vpevo0Jr77S7bvY+RtCkq4JC2uTJGOxC677qlfOJXnsf BQHKlmqEfQqLFtEmoNfQjH63vv9XLFWqtbgmFQatpnl25UAP5lIqa6XabQAlSlgcawxf nR9P4zx+eRzCpVCkR116/DSETW+nSW0zsnJaW0LOqDX0MhvIE2vv6zkwkDDBWaXqjezO O9Qk8TpdnxKlnTD7iCZnlNMkWzXLfKVacRdy1lJjApglSA67gm7enRc/83Q7aYuEevpw 4dobAxAGQYPNK9rI6TJXnzLv2OAe7TdcnmiYi3iGZUwubRwzPJFejCQFAprqKGZy9aDU 6EVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R5Oewy3mbeaqBSIZogGJai9Re52h4zz2ZAPd7tkTAIM=; b=uQBb3w9319MHSSRi2zjKJ9+2w+vSQZPN9Um0C4vIYwhQgsn8KQcExX/cs/skbQrcK7 QsTQ4KfahrV/B5YQOjJLvC7R/AookGpBsCnMt4KdQpADCtMnP2Ca4640vsVHWYMsLFxa rd1ppUHfVd9BhJpkdryDh5pKLamudYpex1E+420qwcIbVynYiIuA7pTbI90y2TvDjZL2 t6w+W/DeXzwT/7tcp+Hn5zUN3acn0u5LqC7rv25M1vFRyP0NCDAjxO+H8wjuwiyRjXR1 MSWj11WC92zN8RRfYbie8w6iXfvrNpazoSYZXsbAQ3hws8vPIdqjwoY1/twoIoO2L4Qf 7mAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JfobuIom; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020a50d6d0000000b004482dd03febsi1511806edj.177.2022.09.27.06.31.59; Tue, 27 Sep 2022 06:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JfobuIom; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbiI0NQL (ORCPT + 99 others); Tue, 27 Sep 2022 09:16:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbiI0NP6 (ORCPT ); Tue, 27 Sep 2022 09:15:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E2AC13F41; Tue, 27 Sep 2022 06:15:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2B0B1B81BBD; Tue, 27 Sep 2022 13:15:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBA48C433B5; Tue, 27 Sep 2022 13:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664284553; bh=lLVeSTRx1wtOeyOrw5Ac0zU5OsqN3eIH/yKi5nlw5oM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JfobuIomzOqA7iIuZRwMLdEfiteOj4BxAZJ0aMBI89dEj2rpxMzHYgkUfekjz5oEk GDWO5JXvIzdJOGZ7jQRBhtL/d1Jb8wW17CVZXx3O5IDl1SF6q725XAJL7U66hx0U6h gFt6S6/6GzvhQmX9t0Vzy1BNdAuD3UQhmefACmtrPuHxVaoM38xhDpb2bT+tEJ7VxP QcY81qnFcwCssmazYJJBTcy/OPRPQiXkzZZ559uWuBQFy2pvcD9tjaGGcefBPADY/9 mpRmWo720SVO1W7NMc1Ym2w/GG00/y3PIPdNq62ebHmpkmcuDwmCHIs9FA2RtPUdGC qnekh2e+bbSAQ== From: Miguel Ojeda To: Linus Torvalds , Greg Kroah-Hartman Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Miguel Ojeda , Boqun Feng , Kees Cook Subject: [PATCH v10 01/27] kallsyms: use `ARRAY_SIZE` instead of hardcoded size Date: Tue, 27 Sep 2022 15:14:32 +0200 Message-Id: <20220927131518.30000-2-ojeda@kernel.org> In-Reply-To: <20220927131518.30000-1-ojeda@kernel.org> References: <20220927131518.30000-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Boqun Feng This removes one place where the `500` constant is hardcoded. Reviewed-by: Kees Cook Signed-off-by: Boqun Feng Co-developed-by: Miguel Ojeda Signed-off-by: Miguel Ojeda --- scripts/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index f18e6dfc68c5..8551513f9311 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -206,7 +206,7 @@ static struct sym_entry *read_symbol(FILE *in) rc = fscanf(in, "%llx %c %499s\n", &addr, &type, name); if (rc != 3) { - if (rc != EOF && fgets(name, 500, in) == NULL) + if (rc != EOF && fgets(name, ARRAY_SIZE(name), in) == NULL) fprintf(stderr, "Read error or end of file.\n"); return NULL; } -- 2.37.3