From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - gcc-fanalyzer: use zeroed memory
Date: Mon, 20 Sep 2021 13:29:50 +0000 (GMT) [thread overview]
Message-ID: <20210920132950.ABE703858C60@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=93d565eda992abc0460cc8fc7b9998bd1996a447
Commit: 93d565eda992abc0460cc8fc7b9998bd1996a447
Parent: 5126ac7c3aa4f9f47a36c66095246d5b13871e61
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Sat Sep 18 21:01:48 2021 +0200
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Sep 20 13:58:57 2021 +0200
gcc-fanalyzer: use zeroed memory
Analyzer here was rather confused about possiblity of loosing previously
assigned device pointers - fixed by passing zero initialize memory
before first assign.
---
daemons/dmeventd/dmeventd.c | 2 +-
tools/vgimportclone.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 041718c7a..c44fa4ed9 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -2069,7 +2069,7 @@ static void _restart_dmeventd(void)
++count;
}
- if (!(_initial_registrations = malloc(sizeof(char*) * (count + 1)))) {
+ if (!(_initial_registrations = zalloc(sizeof(char*) * (count + 1)))) {
fprintf(stderr, "Memory allocation registration failed.\n");
goto bad;
}
diff --git a/tools/vgimportclone.c b/tools/vgimportclone.c
index 8aa0dbba9..23bb6271f 100644
--- a/tools/vgimportclone.c
+++ b/tools/vgimportclone.c
@@ -194,7 +194,7 @@ static int _get_other_devs(struct cmd_context *cmd, struct dm_list *new_devs, st
while ((dev = dev_iter_get(cmd, iter))) {
if (_get_device_list(new_devs, dev))
continue;
- if (!(devl = malloc(sizeof(*devl)))) {
+ if (!(devl = zalloc(sizeof(*devl)))) {
r = 0;
goto_bad;
}
@@ -278,7 +278,7 @@ int vgimportclone(struct cmd_context *cmd, int argc, char **argv)
goto out;
}
- if (!(devl = malloc(sizeof(*devl))))
+ if (!(devl = zalloc(sizeof(*devl))))
goto_out;
devl->dev = dev;
reply other threads:[~2021-09-20 13:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210920132950.ABE703858C60@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.