netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roi Dayan <roid@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: Roi Dayan <roid@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2-next v2] dcb: Fix compilation warning about reallocarray
Date: Mon, 22 Feb 2021 14:10:30 +0200	[thread overview]
Message-ID: <20210222121030.2109-1-roid@nvidia.com> (raw)

In older distros we need bsd/stdlib.h but newer distro doesn't
need it. Also old distro will need libbsd-devel installed and newer
doesn't. To remove a possible dependency on libbsd-devel replace usage
of reallocarray to realloc.

dcb_app.c: In function ‘dcb_app_table_push’:
dcb_app.c:68:25: warning: implicit declaration of function ‘reallocarray’; did you mean ‘realloc’?

Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object")
Signed-off-by: Roi Dayan <roid@nvidia.com>
---

Notes:
    v2
    - tag for iproute next
    - replace reallocarray with realloc instead of messing with libbsd

 dcb/dcb_app.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
index 7ce80f85072b..c4816bc2997f 100644
--- a/dcb/dcb_app.c
+++ b/dcb/dcb_app.c
@@ -65,8 +65,7 @@ static void dcb_app_table_fini(struct dcb_app_table *tab)
 
 static int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app)
 {
-	struct dcb_app *apps = reallocarray(tab->apps, tab->n_apps + 1,
-					    sizeof(*tab->apps));
+	struct dcb_app *apps = realloc(tab->apps, (tab->n_apps + 1) * sizeof(*tab->apps));
 
 	if (apps == NULL) {
 		perror("Cannot allocate APP table");
-- 
2.8.0


             reply	other threads:[~2021-02-22 12:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22 12:10 Roi Dayan [this message]
2021-02-22 12:30 ` [PATCH iproute2-next v2] dcb: Fix compilation warning about reallocarray Petr Machata
2021-03-15 13:10   ` Petr Machata
2021-03-15 15:09     ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210222121030.2109-1-roid@nvidia.com \
    --to=roid@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).