All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Al Viro <viro@ftp.linux.org.uk>,
	Linus Torvalds <torvalds@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] affs_fill_super() %s abuses
Date: Thu, 15 Jun 2006 14:40:40 +0200	[thread overview]
Message-ID: <jer71qa8xj.fsf@sykes.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0606151427290.17704@scrub.home> (Roman Zippel's message of "Thu, 15 Jun 2006 14:31:05 +0200 (CEST)")

Roman Zippel <zippel@linux-m68k.org> writes:

> Hi,
>
> On Thu, 15 Jun 2006, Al Viro wrote:
>
>> @@ -420,11 +422,17 @@ got_root:
>>  	}
>>  
>>  	if (mount_flags & SF_VERBOSE) {
>> -		chksum = cpu_to_be32(chksum);
>> -		printk(KERN_NOTICE "AFFS: Mounting volume \"%*s\": Type=%.3s\\%c, Blocksize=%d\n",
>> -			AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0],
>> -			AFFS_ROOT_TAIL(sb, root_bh)->disk_name + 1,
>> -			(char *)&chksum,((char *)&chksum)[3] + '0',blocksize);
>> +		int len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0];
>> +		char name[32];
>> +
>> +		if (len > 31)
>> +			len = 31;
>
> You get the same effect by changing it above into "min(AFFS_ROOT_TAIL(sb, 
> root_bh)->disk_name[0], 31)" and makes the copying unnecessary.

And "%*s" needs to be changed to "%.*s" (the former still requires a
NUL-terminated string).

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

      parent reply	other threads:[~2006-06-15 12:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-15 11:03 [PATCH] affs_fill_super() %s abuses Al Viro
2006-06-15 11:56 ` Andreas Schwab
2006-06-15 12:02   ` Al Viro
2006-06-15 12:31 ` Roman Zippel
2006-06-15 12:39   ` Al Viro
2006-06-15 12:40   ` Andreas Schwab [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jer71qa8xj.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.