All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyich@gmail.com>
To: richard -rw- weinberger <richard.weinberger@gmail.com>
Cc: "Toralf Förster" <toralf.foerster@gmx.de>,
	"user-mode-linux-devel@lists.sourceforge.net"
	<user-mode-linux-devel@lists.sourceforge.net>,
	"Dave Jones" <davej@redhat.com>
Subject: Re: [uml-devel] Fwd: Re: [uml-user] WARNING: at mm/slab_common.c:376 kmalloc_slab+0x33/0x80()
Date: Sat, 11 May 2013 16:26:37 +0300	[thread overview]
Message-ID: <20130511162637.27f475df@sf> (raw)
In-Reply-To: <CAFLxGvyYRBspKZiqOe+NSW+B_02oS3TVH9WM9nXBDRiDdKjTRA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1388 bytes --]

On Sat, 11 May 2013 13:29:23 +0200
richard -rw- weinberger <richard.weinberger@gmail.com> wrote:

> On Sat, May 11, 2013 at 1:01 PM, Sergei Trofimovich <slyich@gmail.com> wrote:
> >> With this change:
> >>
> >> diff --git a/fs/namespace.c b/fs/namespace.c
> >> index 7b1ca9b..289211d 100644
> >> --- a/fs/namespace.c
> >> +++ b/fs/namespace.c
> >> @@ -2236,6 +2236,8 @@ int copy_mount_string(const void __user *data, char **where)
> >>                 return 0;
> >>         }
> >>
> >> +       printk(" here: size is %ul\n", (unsigned long)data);
> >
> > Be careful, it's long->int truncation. I guess you want '%lu' instead of '%ul'.
> 
> Erm, data is a character array...

Gah, sorry!

Toralf, it's better to use strnlen_user for it:

--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2230,12 +2230,16 @@ int copy_mount_options(const void __user * data, unsigned long *where)
 int copy_mount_string(const void __user *data, char **where)
 {
        char *tmp;
+       long data_len;

        if (!data) {
                *where = NULL;
                return 0;
        }

+       data_len = strnlen_user (data, (long)(~0ul >> 1) /* LONG_MAX */);
+       printk("%s: __user * data size is %lu\n", __func__, data_len);
+
        tmp = strndup_user(data, PAGE_SIZE);
        if (IS_ERR(tmp))
                return PTR_ERR(tmp);

-- 

  Sergei

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 403 bytes --]

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may

[-- Attachment #3: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

  reply	other threads:[~2013-05-11 13:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 21:52 WARNING: at mm/slab_common.c:376 kmalloc_slab+0x33/0x80() Toralf Förster
2013-05-11  8:19 ` Toralf Förster
2013-05-11  8:20 ` [uml-user] " richard -rw- weinberger
2013-05-11  8:36   ` [uml-devel] Fwd: " Toralf Förster
2013-05-11  8:47     ` richard -rw- weinberger
2013-05-11  9:51       ` Toralf Förster
2013-05-11 11:01         ` Sergei Trofimovich
2013-05-11 11:29           ` richard -rw- weinberger
2013-05-11 13:26             ` Sergei Trofimovich [this message]
2013-05-11 12:26           ` richard -rw- weinberger
2013-05-11 12:27             ` richard -rw- weinberger
2013-05-11 13:19               ` Toralf Förster
2013-05-11 13:26                 ` richard -rw- weinberger
2013-05-11 13:37                   ` richard -rw- weinberger
2013-05-11 13:51                     ` Toralf Förster
2013-05-11 13:48                   ` Toralf Förster

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=20130511162637.27f475df@sf \
    --to=slyich@gmail.com \
    --cc=davej@redhat.com \
    --cc=richard.weinberger@gmail.com \
    --cc=toralf.foerster@gmx.de \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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.