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] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0acebb66b9b46ad472e0d0989dc0f5810cac3dd.camel@perches.com>
Date:   Wed, 18 May 2022 11:12:11 -0700
From:   Joe Perches <joe@...ches.com>
To:     Yu Kuai <yukuai3@...wei.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

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...

> @@ -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