diff mbox series

[01/11] Expand fixed buffers for pretty-printed hardware addresses

Message ID 6b00580e0a184ab2392ac9ec124285652f7c95e2.1587059234.git.weeksd2@rpi.edu
State New
Headers show
Series IB netboot 2/3: longer hwaddr/guid support | expand

Commit Message

Daniel M. Weeks April 16, 2020, 5:58 p.m. UTC
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 <weeksd2@rpi.edu>
---
 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 mbox series

Patch

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);