From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 15 May 2023 10:52:10 +0200 From: Alexey Gladkov To: make-initrd@lists.altlinux.org Message-ID: References: <6b444ed922286eb3df8f5322b1bddf9c55753eb8.1683200226.git.gladkov.alexey@gmail.com> <688b5ae2-8f4e-e3fc-9712-e4d6a14ef22a@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <688b5ae2-8f4e-e3fc-9712-e4d6a14ef22a@gmail.com> Subject: Re: [make-initrd] [PATCH 1/3] Reimplement ueventd X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 May 2023 08:52:12 -0000 Archived-At: List-Archive: On Sun, May 14, 2023 at 11:57:53PM +0300, Leonid Krivoshein wrote: > > On 5/4/23 16:42, Alexey Gladkov wrote: > > [...] > > diff --git a/datasrc/ueventd/memory.c b/datasrc/ueventd/memory.c > > new file mode 100644 > > index 00000000..cb911d58 > > --- /dev/null > > +++ b/datasrc/ueventd/memory.c > > @@ -0,0 +1,32 @@ > > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "ueventd.h" > > + > > +void *xcalloc(size_t nmemb, size_t size) > > +{ > > + void *r = calloc(nmemb, size); > > + if (!r) > > + fatal("calloc: allocating %lu*%lu bytes: %m", > > + (unsigned long) nmemb, (unsigned long) size); > > Есть "%zu". Да, согласен. > > > + return r; > > +} > > + > > +char *xasprintf(char **ptr, const char *fmt, ...) > > +{ > > + va_list arg; > > + > > + va_start(arg, fmt); > > + if (vasprintf(ptr, fmt, arg) < 0) > > Здесь и > > > + fatal("vasprintf: %m"); > > + va_end(arg); > > + > > + return *ptr; > > и тут возможно разыменование ссылки на NULL, поскольку ptr в коде не > проверяется и в заголовочном файле xasprintf() не объявлен как nonnull(1). Согласен. Нужно добавить аттрибут nonnull(1,2). > > > +} > > [...] > > > -- > WBR, Leonid Krivoshein. > _______________________________________________ > Make-initrd mailing list > Make-initrd@lists.altlinux.org > https://lists.altlinux.org/mailman/listinfo/make-initrd -- Rgrds, legion