All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Fabian Frederick <fabf@skynet.be>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: akpm <akpm@linux-foundation.org>, Dave <shaggy@kernel.org>
Subject: Re: [PATCH 1/1] fs/jfs/super.c: convert simple_str to kstr
Date: Tue, 03 Jun 2014 14:22:18 -0500	[thread overview]
Message-ID: <538E206A.10400@oracle.com> (raw)
In-Reply-To: <20140521202929.00437eb6cf5290b51102bb18@skynet.be>

Fabian,
I finally got to pushing this and your previous jfs cleanups to
git://github.com/kleikamp/linux-shaggy.git jfs-next

I'll give them a day or two in the next tree, then push them to Linus.

I modified this patch slightly, but the others are unchanged.

Thanks,
Dave

On 05/21/2014 01:29 PM, Fabian Frederick wrote:
> This patch replaces obsolete simple_str functions by kstr
> 
> use kstrtouint for
> -uid_t ( __kernel_uid32_t )
> -gid_t ( __kernel_gid32_t )
> -jfs_sb_info->umask
> -jfs_sb_info->minblks_trim
> (all unsigned int)
> 
> newLVSize is s64 -> use kstrtol
> 
> Current parse_options behaviour stays the same ie it doesn't return kstr
> rc but just 0 if function failed (parse_options callsites
> return -EINVAL when there's anything wrong).
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> ---
>  fs/jfs/super.c | 29 +++++++++++++++++++++++------
>  1 file changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/jfs/super.c b/fs/jfs/super.c
> index 97f7fda..fe09e5d 100644
> --- a/fs/jfs/super.c
> +++ b/fs/jfs/super.c
> @@ -273,7 +273,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
>  		case Opt_resize:
>  		{
>  			char *resize = args[0].from;
> -			*newLVSize = simple_strtoull(resize, &resize, 0);
> +			int rc = kstrtoll(resize, 0, newLVSize);
> +
> +			if (rc)
> +				return 0;

Should goto cleanup here, or it's possible to leak a newly allocated
nls_map.

>  			break;
>  		}
>  		case Opt_resize_nosize:
> @@ -327,7 +330,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
>  		case Opt_uid:
>  		{
>  			char *uid = args[0].from;
> -			uid_t val = simple_strtoul(uid, &uid, 0);
> +			uid_t val;
> +			int rc = kstrtouint(uid, 0, &val);
> +
> +			if (rc)
> +				return 0;

same here

>  			sbi->uid = make_kuid(current_user_ns(), val);
>  			if (!uid_valid(sbi->uid))
>  				goto cleanup;
> @@ -337,7 +344,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
>  		case Opt_gid:
>  		{
>  			char *gid = args[0].from;
> -			gid_t val = simple_strtoul(gid, &gid, 0);
> +			gid_t val;
> +			int rc = kstrtouint(gid, 0, &val);
> +
> +			if (rc)
> +				return 0;

same here

>  			sbi->gid = make_kgid(current_user_ns(), val);
>  			if (!gid_valid(sbi->gid))
>  				goto cleanup;
> @@ -347,7 +358,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
>  		case Opt_umask:
>  		{
>  			char *umask = args[0].from;
> -			sbi->umask = simple_strtoul(umask, &umask, 8);
> +			int rc = kstrtouint(umask, 8, &sbi->umask);
> +
> +			if (rc)
> +				return 0;

same here

>  			if (sbi->umask & ~0777) {
>  				pr_err("JFS: Invalid value of umask\n");
>  				goto cleanup;
> @@ -380,10 +394,13 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
>  		{
>  			struct request_queue *q = bdev_get_queue(sb->s_bdev);
>  			char *minblks_trim = args[0].from;
> +			int rc;
>  			if (blk_queue_discard(q)) {
>  				*flag |= JFS_DISCARD;
> -				sbi->minblks_trim = simple_strtoull(
> -					minblks_trim, &minblks_trim, 0);
> +				rc = kstrtouint(minblks_trim, 0,
> +					       &sbi->minblks_trim);
> +				if (rc)
> +					return 0;

and here too

>  			} else {
>  				pr_err("JFS: discard option " \
>  					"not supported on device\n");
> 

      reply	other threads:[~2014-06-03 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 18:29 [PATCH 1/1] fs/jfs/super.c: convert simple_str to kstr Fabian Frederick
2014-06-03 19:22 ` Dave Kleikamp [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=538E206A.10400@oracle.com \
    --to=dave.kleikamp@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaggy@kernel.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.