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: <e562426e9cf94621a2a8a1481730f5bd@AcuMS.aculab.com>
Date:   Wed, 25 May 2022 15:18:01 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Yu Zhe' <yuzhe@...china.com>, "tytso@....edu" <tytso@....edu>,
        "adilger.kernel@...ger.ca" <adilger.kernel@...ger.ca>
CC:     "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "liqiong@...china.com" <liqiong@...china.com>
Subject: RE: [PATCH] ext4: add KERN_<LEVEL> for printk()

From: Yu Zhe
> Sent: 25 May 2022 13:48
> 
> printk() should include KERN_<LEVEL> facility level, add them.

They should also have an "ext3: " prefix.

Isn't pr_warn() the function you are really looking for?

	David

> 
> Signed-off-by: Yu Zhe <yuzhe@...china.com>
> ---
>  fs/ext4/inode.c |  2 +-
>  fs/ext4/namei.c | 14 +++++++-------
>  fs/ext4/super.c |  4 ++--
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 3dce7d058985..6d6899191779 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -462,7 +462,7 @@ static void ext4_map_blocks_es_recheck(handle_t *handle,
>  	if (es_map->m_lblk != map->m_lblk ||
>  	    es_map->m_flags != map->m_flags ||
>  	    es_map->m_pblk != map->m_pblk) {
> -		printk("ES cache assertion failed for inode: %lu "
> +		printk(KERN_WARNING "ES cache assertion failed for inode: %lu "
>  		       "es_cached ex [%d/%d/%llu/%x] != "
>  		       "found ex [%d/%d/%llu/%x] retval %d flags %x\n",
>  		       inode->i_ino, es_map->m_lblk, es_map->m_len,
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 47d0ca4c795b..89445661f71d 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -628,7 +628,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  	char *base = (char *) de;
>  	struct dx_hash_info h = *hinfo;
> 
> -	printk("names: ");
> +	printk(KERN_WARNING "names: ");
>  	while ((char *) de < base + size)
>  	{
>  		if (de->inode)
> @@ -648,7 +648,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  					/* Directory is not encrypted */
>  					ext4fs_dirhash(dir, de->name,
>  						de->name_len, &h);
> -					printk("%*.s:(U)%x.%u ", len,
> +					printk(KERN_WARNING "%*.s:(U)%x.%u ", len,
>  					       name, h.hash,
>  					       (unsigned) ((char *) de
>  							   - base));
> @@ -683,7 +683,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  					else
>  						ext4fs_dirhash(dir, de->name,
>  						       de->name_len, &h);
> -					printk("%*.s:(E)%x.%u ", len, name,
> +					printk(KERN_WARNING "%*.s:(E)%x.%u ", len, name,
>  					       h.hash, (unsigned) ((char *) de
>  								   - base));
>  					fscrypt_fname_free_buffer(
> @@ -693,7 +693,7 @@ static struct stats dx_show_leaf(struct inode *dir,
>  				int len = de->name_len;
>  				char *name = de->name;
>  				ext4fs_dirhash(dir, de->name, de->name_len, &h);
> -				printk("%*.s:%x.%u ", len, name, h.hash,
> +				printk(KERN_WARNING "%*.s:%x.%u ", len, name, h.hash,
>  				       (unsigned) ((char *) de - base));
>  #endif
>  			}
> @@ -713,14 +713,14 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
>  	unsigned count = dx_get_count(entries), names = 0, space = 0, i;
>  	unsigned bcount = 0;
>  	struct buffer_head *bh;
> -	printk("%i indexed blocks...\n", count);
> +	printk(KERN_WARNING "%i indexed blocks...\n", count);
>  	for (i = 0; i < count; i++, entries++)
>  	{
>  		ext4_lblk_t block = dx_get_block(entries);
>  		ext4_lblk_t hash  = i ? dx_get_hash(entries): 0;
>  		u32 range = i < count - 1? (dx_get_hash(entries + 1) - hash): ~hash;
>  		struct stats stats;
> -		printk("%s%3u:%03u hash %8x/%8x ",levels?"":"   ", i, block, hash, range);
> +		printk(KERN_WARNING "%s%3u:%03u hash %8x/%8x ",levels?"":"   ", i, block, hash, range);
>  		bh = ext4_bread(NULL,dir, block, 0);
>  		if (!bh || IS_ERR(bh))
>  			continue;
> @@ -855,7 +855,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
>  		goto fail;
>  	}
> 
> -	dxtrace(printk("Look up %x", hash));
> +	dxtrace(printk(KERN_WARNING "Look up %x", hash));
>  	level = 0;
>  	blocks[0] = 0;
>  	while (1) {
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 450c918d68fc..f1f0427b55a6 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -941,9 +941,9 @@ void __ext4_msg(struct super_block *sb,
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
>  	if (sb)
> -		printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
> +		printk(KERN_WARNING "%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
>  	else
> -		printk("%sEXT4-fs: %pV\n", prefix, &vaf);
> +		printk(KERN_WARNING "%sEXT4-fs: %pV\n", prefix, &vaf);
>  	va_end(args);
>  }
> 
> --
> 2.25.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ