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: <65fe63ed-91d4-35bd-3e25-39c4457295d0@huawei.com>
Date:   Thu, 19 May 2022 09:06:20 +0800
From:   "yukuai (C)" <yukuai3@...wei.com>
To:     Joe Perches <joe@...ches.com>, <josef@...icpanda.com>,
        <axboe@...nel.dk>, <ming.lei@...hat.com>
CC:     <linux-block@...r.kernel.org>, <nbd@...er.debian.org>,
        <linux-kernel@...r.kernel.org>, <yi.zhang@...wei.com>
Subject: Re: [PATCH -next v2 6/6] nbd: use pr_err to output error message

在 2022/05/19 2:12, Joe Perches 写道:
> On Wed, 2022-05-18 at 20:26 +0800, Yu Kuai wrote:
>> Instead of using the long printk(KERN_ERR "nbd: ...") to
>> output error message, defining pr_fmt and using
>> the short pr_err("") to do that. The replacemen is done
>> by using the following command:
>>
>>    sed -i 's/printk(KERN_ERR "nbd: /pr_err("/g' \
>> 		  drivers/block/nbd.c
> 
> It's also good to rewrap to 80 columns where possible.
> 
>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> []
>> @@ -2130,13 +2130,13 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
>>   	nbd = idr_find(&nbd_index_idr, index);
>>   	if (!nbd) {
>>   		mutex_unlock(&nbd_index_mutex);
>> -		printk(KERN_ERR "nbd: couldn't find device at index %d\n",
>> +		pr_err("couldn't find device at index %d\n",
>>   		       index);
> 
> like here
> 
>>   		return -EINVAL;
>>   	}
>>   	if (!refcount_inc_not_zero(&nbd->refs)) {
>>   		mutex_unlock(&nbd_index_mutex);
>> -		printk(KERN_ERR "nbd: device at index %d is going down\n",
>> +		pr_err("device at index %d is going down\n",
>>   		       index);
> 
> and here and below...
Hi, Josef

Thanks for your advice, I'll send a new version.
> 
>> @@ -2170,7 +2170,7 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
>>   	nbd = idr_find(&nbd_index_idr, index);
>>   	if (!nbd) {
>>   		mutex_unlock(&nbd_index_mutex);
>> -		printk(KERN_ERR "nbd: couldn't find a device at index %d\n",
>> +		pr_err("couldn't find a device at index %d\n",
>>   		       index);
>>   		return -EINVAL;
>>   	}
>> @@ -2192,7 +2192,7 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
>>   	}
>>   	if (!refcount_inc_not_zero(&nbd->refs)) {
>>   		mutex_unlock(&nbd_index_mutex);
>> -		printk(KERN_ERR "nbd: device at index %d is going down\n",
>> +		pr_err("device at index %d is going down\n",
>>   		       index);
>>   		return -EINVAL;
>>   	}
> 
> 
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ