Skip to content

Commit e9baa4a

Browse files
author
Tobias Huschle
committed
s390/qeth: Use constant for IP address buffers
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2160097 Upstream status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Tested: by IBM Build-Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=52483305 Conflicts: None commit 180f513 Author: Thorsten Winkler <twinkler@linux.ibm.com> Date: Thu Feb 9 12:04:22 2023 +0100 s390/qeth: Use constant for IP address buffers Use INET6_ADDRSTRLEN constant with size of 48 which be used for char arrays storing ip addresses (for IPv4 and IPv6) Reviewed-by: Alexandra Winter <wintera@linux.ibm.com> Signed-off-by: Thorsten Winkler <twinkler@linux.ibm.com> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Tobias Huschle <thuschle@redhat.com>
1 parent b818320 commit e9baa4a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

drivers/s390/net/qeth_l3_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/etherdevice.h>
2020
#include <linux/ip.h>
2121
#include <linux/in.h>
22+
#include <linux/inet.h>
2223
#include <linux/ipv6.h>
2324
#include <linux/inetdevice.h>
2425
#include <linux/igmp.h>
@@ -158,7 +159,7 @@ static int qeth_l3_add_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr)
158159
{
159160
int rc = 0;
160161
struct qeth_ipaddr *addr;
161-
char buf[40];
162+
char buf[INET6_ADDRSTRLEN];
162163

163164
if (tmp_addr->type == QETH_IP_TYPE_RXIP)
164165
QETH_CARD_TEXT(card, 2, "addrxip");

drivers/s390/net/qeth_l3_sys.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static ssize_t qeth_l3_dev_ipato_add_show(char *buf, struct qeth_card *card,
371371

372372
mutex_lock(&card->ip_lock);
373373
list_for_each_entry(ipatoe, &card->ipato.entries, entry) {
374-
char addr_str[40];
374+
char addr_str[INET6_ADDRSTRLEN];
375375
int entry_len;
376376

377377
if (ipatoe->proto != proto)
@@ -413,7 +413,7 @@ static int qeth_l3_parse_ipatoe(const char *buf, enum qeth_prot_versions proto,
413413
int rc;
414414

415415
/* Expected input pattern: %addr/%mask */
416-
sep = strnchr(buf, 40, '/');
416+
sep = strnchr(buf, INET6_ADDRSTRLEN, '/');
417417
if (!sep)
418418
return -EINVAL;
419419

@@ -592,7 +592,7 @@ static ssize_t qeth_l3_dev_ip_add_show(struct device *dev, char *buf,
592592

593593
mutex_lock(&card->ip_lock);
594594
hash_for_each(card->ip_htable, i, ipaddr, hnode) {
595-
char addr_str[40];
595+
char addr_str[INET6_ADDRSTRLEN];
596596
int entry_len;
597597

598598
if (ipaddr->proto != proto || ipaddr->type != type)

0 commit comments

Comments
 (0)