From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684097875; x=1686689875; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=xTfOi++ikZc2ZBKFo4ZxU4nEUnfK3UyEslAlhDWzBVQ=; b=BtnX3HSgdAG9e9zdMKFL/SBmuP9PXFJZSgfn2ZVZRXbnfHj9nlht4AVHZ0Wg3QxQ0Z zj3i81OqYHoRjKL25Zl3MPyufgqeL8j8OhL7iK65L/ft98FTh3akn+oNmx6gncgCkJmh tkK8gsy5s1vCUXHw2e6i6Ur+DkazEzaECP/X3B8yMbltG9+xi0sbs/9KeJPR22M2s9KE HfxWavOJHvaM+LAGrIRm2siUKwmly4uVZcXw3rTcD/SzY7p9EyxwFH/4Mf6f+2CvrEQH Hc4jF5scjTG/F0BlDcA6Z4U6V5gxEkmTV2hWjH3BKWT771AV0jJODfcGE2ofrdWm3mZP 7HFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684097875; x=1686689875; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xTfOi++ikZc2ZBKFo4ZxU4nEUnfK3UyEslAlhDWzBVQ=; b=Yv+ImXLUzgSh+Dbgv6hNXbN4XN7y75J3VCTJD+X9zx/mLXrkE2Y/fcuXDrXi2UtjPw iBBvj4nu7rj6JqujY6HOVUii8zi2XYFUwyrzEoZzLmU8ow0RjtuAs943fuKSJzecdQND +9mtXBQwF4XF+2gYsieS/Fsnm8z7O9GR8ZLOaGV7hqQ43/r+C5zJFq/7fF+DJQXuZMHA UTXWnJnfqEcKcVIbez5OvybfkFcOks6ZXuIKVT6fCBgItJZ6ZJhgIsAUMzcocVlU6yp4 TMkhFszheanZg5qN+UjEcGVF9yPWZvWI1u4zcmHJNQSediXE5MnauvLf3ujzYwwGIDcN cEdQ== X-Gm-Message-State: AC+VfDwU8z+hBKvIUKnTXxGc6PsOaKgheBVQxG1ev0UIcPjkgIzuHYz3 cErs2ykQHhYYxMqhAjBT74B55bBcenE= X-Google-Smtp-Source: ACHHUZ7eTr7l+8wDG70cLdkESM2PUQEsZMgqautMceqdTsiMMDq3fpgz/lrRKTQ2d1S6XX+m99qWGg== X-Received: by 2002:a05:6808:1824:b0:394:6952:36c6 with SMTP id bh36-20020a056808182400b00394695236c6mr6325299oib.27.1684097874797; Sun, 14 May 2023 13:57:54 -0700 (PDT) Message-ID: <688b5ae2-8f4e-e3fc-9712-e4d6a14ef22a@gmail.com> Date: Sun, 14 May 2023 23:57:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.10.0 Content-Language: ru, en-US To: make-initrd@lists.altlinux.org References: <6b444ed922286eb3df8f5322b1bddf9c55753eb8.1683200226.git.gladkov.alexey@gmail.com> From: Leonid Krivoshein In-Reply-To: <6b444ed922286eb3df8f5322b1bddf9c55753eb8.1683200226.git.gladkov.alexey@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: Sun, 14 May 2023 20:57:58 -0000 Archived-At: List-Archive: 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). > +} > [...] -- WBR, Leonid Krivoshein.