lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <16b70aac-fc5d-4aed-934d-19cb5ead1b8f@nvidia.com>
Date: Thu, 5 Dec 2024 07:49:35 +0000
From: Chaitanya Kulkarni <chaitanyak@...dia.com>
To: liujing <liujing@...s.chinamobile.com>, "axboe@...nel.dk"
	<axboe@...nel.dk>
CC: "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] block: Fix the wrong format specifier

On 12/4/24 06:45, liujing wrote:
> Make a minor change to eliminate a static checker warning. The type
> of 'size' is unsigned int, so the correct format specifier should be
> %u instead of %d.
>
> Signed-off-by: liujing <liujing@...s.chinamobile.com>
>
> diff --git a/block/bio.c b/block/bio.c
> index ac4d77c88932..3a75de450799 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -89,7 +89,7 @@ static struct bio_slab *create_bio_slab(unsigned int size)
>   	if (!bslab)
>   		return NULL;
>   
> -	snprintf(bslab->name, sizeof(bslab->name), "bio-%d", size);
> +	snprintf(bslab->name, sizeof(bslab->name), "bio-%u", size);
>   	bslab->slab = kmem_cache_create(bslab->name, size,
>   			ARCH_KMALLOC_MINALIGN,
>   			SLAB_HWCACHE_ALIGN | SLAB_TYPESAFE_BY_RCU, NULL);

Indeed, looks good, but patch format looks little bit different ...

Reviewed-by: Chaitanya Kulkarni <kch@...dia.com>

-ck


static struct bio_slab *create_bio_slab(unsigned int size)
{
         struct bio_slab *bslab = kzalloc(sizeof(*bslab), GFP_KERNEL);

         if (!bslab)
                 return NULL;

         snprintf(bslab->name, sizeof(bslab->name), "bio-%d", size);
         bslab->slab = kmem_cache_create(bslab->name, size,
                         ARCH_KMALLOC_MINALIGN,
                         SLAB_HWCACHE_ALIGN | SLAB_TYPESAFE_BY_RCU, NULL);
         if (!bslab->slab)
                 goto fail_alloc_slab;

         bslab->slab_ref = 1;
         bslab->slab_size = size;

         if (!xa_err(xa_store(&bio_slabs, size, bslab, GFP_KERNEL)))
                 return bslab;

         kmem_cache_destroy(bslab->slab);

fail_alloc_slab:
         kfree(bslab);
         return NULL;
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ