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: <809c7cb8-6602-8568-cd91-33281a6fb508@huawei.com>
Date:   Sat, 23 Jul 2022 12:08:33 +0800
From:   Yu Kuai <yukuai3@...wei.com>
To:     Joe Perches <joe@...ches.com>, Yu Kuai <yukuai1@...weicloud.com>,
        <josef@...icpanda.com>, <axboe@...nel.dk>, <houtao1@...wei.com>
CC:     <linux-block@...r.kernel.org>, <nbd@...er.debian.org>,
        <linux-kernel@...r.kernel.org>, <yi.zhang@...wei.com>
Subject: Re: [PATCH] nbd: add missing definition of pr_fmt

Hi!

在 2022/07/23 11:12, Joe Perches 写道:
> On Sat, 2022-07-23 at 10:15 +0800, Yu Kuai wrote:
>> Hi!
> 
> Hello.
> 
>> 在 2022/07/20 19:46, Yu Kuai 写道:
>>> 在 2022/07/18 22:32, Joe Perches 写道:
>>>> On Mon, 2022-07-18 at 21:52 +0800, Yu Kuai wrote:
>>>>> 在 2022/07/06 17:33, Yu Kuai 写道:
>>>>>> From: Yu Kuai <yukuai3@...wei.com>
>>>>>>
>>>>>> commit 1243172d5894 ("nbd: use pr_err to output error message") tries
>>>>>> to define pr_fmt and use short pr_err() to output error message,
>>>>>> however, the definition is missed.
>>>>> friendly ping ...
>>>> []
>>>>>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>>>> []
>>>>>> @@ -44,6 +44,9 @@
>>>>>>     #include <linux/nbd-netlink.h>
>>>>>>     #include <net/genetlink.h>
>>>>>> +#undef pr_fmt
>>>>>> +#define pr_fmt(fmt) "nbd: " fmt
>>>>>> +
>>>> Typically, this #define is place before all #include lines
>>>> so there is no need for an #undef
>>
>> I tried to remove the #undef:
> 
> I'll repeat my message.
> 
> Move the #define before _any_ #include.
> 
> Also, there are some message that would need existing "nbd: " output
> prefixes removed.

Thanks for your explanation, I do miss that.

Kuai
> ---
>   drivers/block/nbd.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index f5d098a148cbf..222f26ac5e96a 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -11,6 +11,8 @@
>    * (part of code stolen from loop.c)
>    */
>   
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>   #include <linux/major.h>
>   
>   #include <linux/blkdev.h>
> @@ -1950,8 +1952,8 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
>   			     test_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags)) ||
>   			    !refcount_inc_not_zero(&nbd->refs)) {
>   				mutex_unlock(&nbd_index_mutex);
> -				pr_err("nbd: device at index %d is going down\n",
> -					index);
> +				pr_err("device at index %d is going down\n",
> +				       index);
>   				return -EINVAL;
>   			}
>   		}
> @@ -1961,7 +1963,7 @@ static int nbd_genl_connect(struct sk_buff *skb, struct genl_info *info)
>   	if (!nbd) {
>   		nbd = nbd_dev_add(index, 2);
>   		if (IS_ERR(nbd)) {
> -			pr_err("nbd: failed to add new device\n");
> +			pr_err("failed to add new device\n");
>   			return PTR_ERR(nbd);
>   		}
>   	}
> 
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ