From patchwork Thu Apr 16 17:58:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel M. Weeks" X-Patchwork-Id: 1271837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4936TV0jS4z9sWT for ; Fri, 17 Apr 2020 04:00:46 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rpi.edu Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4936TT4FDNzDrgC for ; Fri, 17 Apr 2020 04:00:45 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rpi.edu (client-ip=128.113.2.229; helo=smtp9.server.rpi.edu; envelope-from=weeksd2@rpi.edu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=rpi.edu Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4936R94S5FzDsGt for ; Fri, 17 Apr 2020 03:58:45 +1000 (AEST) Received: from smtp-auth2.server.rpi.edu (smtp-auth2.server.rpi.edu [128.113.2.232]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 03GHwfrA116507 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 13:58:41 -0400 Received: from smtp-auth2.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth2.server.rpi.edu (Postfix) with ESMTP id ED4F11A100 for ; Thu, 16 Apr 2020 13:58:40 -0400 (EDT) Received: from dev.danweeks.net (cpe-74-70-107-6.nycap.res.rr.com [74.70.107.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: weeksd2) by smtp-auth2.server.rpi.edu (Postfix) with ESMTPSA id CC6201A0E7 for ; Thu, 16 Apr 2020 13:58:40 -0400 (EDT) Date: Thu, 16 Apr 2020 13:58:39 -0400 From: "Daniel M. Weeks" To: petitboot@lists.ozlabs.org Subject: [PATCH 01/11] Expand fixed buffers for pretty-printed hardware addresses Message-ID: <6b00580e0a184ab2392ac9ec124285652f7c95e2.1587059234.git.weeksd2@rpi.edu> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 022rtWFf4 X-CanIt-Geo: ip=74.70.107.6; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" This makes the buffers used to generate pretty-printed hardware addresses a consistent length which is long enough to hold an Infiniband GUID. It also serves as a reference point for future cleanup so this can be reduced to a single definition. Signed-off-by: Daniel M. Weeks --- discover/sysinfo.c | 2 +- ui/ncurses/nc-config.c | 8 ++++---- ui/ncurses/nc-menu.c | 2 +- ui/ncurses/nc-sysinfo.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/discover/sysinfo.c b/discover/sysinfo.c index 73012e8..6b3b415 100644 --- a/discover/sysinfo.c +++ b/discover/sysinfo.c @@ -33,7 +33,7 @@ void system_info_set_interface_address(unsigned int hwaddr_size, { struct interface_info *if_info; unsigned int i; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ for (i = 0; i < sysinfo->n_interfaces; i++) { if_info = sysinfo->interfaces[i]; diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index 4eb2499..801e0bb 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -209,7 +209,7 @@ static int screen_process_form(struct config_screen *screen) struct config *config; int i, n_boot_opts, rc; unsigned int *order, idx; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ config = config_copy(screen, screen->cui->config); @@ -812,7 +812,7 @@ static int find_autoboot_idx(const struct system_info *sysinfo, for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac)); @@ -894,7 +894,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; - char mac[20]; + char mac[32]; /* at least 24B for IB GUID */ mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac)); @@ -986,7 +986,7 @@ static void config_screen_setup_widgets(struct config_screen *screen, for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; - char str[50], mac[20]; + char str[50], mac[32]; /* at least 24B for IB GUID */ bool is_default; is_default = ifcfg && !hwaddr_cmp(ifcfg->hwaddr, ifcfg->hwaddr_len, info->hwaddr, diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c index a6c2b15..05a0535 100644 --- a/ui/ncurses/nc-menu.c +++ b/ui/ncurses/nc-menu.c @@ -249,7 +249,7 @@ struct pmenu_item *pmenu_find_device(struct pmenu *menu, struct device *dev, struct blockdev_info *bd; struct cui_opt_data *cod; struct system_info *sys; - char hwaddr[32]; + char hwaddr[32]; /* at least 24B for IB GUID */ unsigned int i; char buf[256]; diff --git a/ui/ncurses/nc-sysinfo.c b/ui/ncurses/nc-sysinfo.c index f0f9cb1..ef5d237 100644 --- a/ui/ncurses/nc-sysinfo.c +++ b/ui/ncurses/nc-sysinfo.c @@ -51,7 +51,7 @@ static void if_info_mac_str(struct interface_info *info, static void sysinfo_screen_populate(struct sysinfo_screen *screen, const struct system_info *sysinfo) { - char macbuf[32]; + char macbuf[32]; /* at least 24B for IB GUID */ unsigned int i; text_screen_clear(&screen->text_scr);