All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] dma-debug: add debugfs file for driver filter
Date: Tue, 2 Jun 2009 15:33:21 +0200	[thread overview]
Message-ID: <20090602133321.GA2231@amd.com> (raw)
In-Reply-To: <20090601150418.79dfd250.akpm@linux-foundation.org>

On Mon, Jun 01, 2009 at 03:04:18PM -0700, Andrew Morton wrote:
> On Thu, 28 May 2009 17:19:29 +0200
> Joerg Roedel <joerg.roedel@amd.com> wrote:
> 
> > +	/*
> > +	 * We can't copy from userspace directly. Access to
> > +	 * current_driver_name is protected with a write_lock with irqs
> > +	 * disabled. Since copy_from_user can fault and may sleep we
> > +	 * need to copy to temporary buffer first
> > +	 */
> > +	len = min(count, len);
> > +	if (copy_from_user(buf, userbuf, len))
> > +		return -EFAULT;
> > +
> > +	buf[NAME_MAX_LEN - 1] = 0;
> 
> Might be able to use strncpy_from_user() here.
>

Hmm, no, not in this place because I can't be sure that userspace passes
a NULL-terminated string. So setting a character in the resulting string
to \0 is always required. This eliminates the benefit of
strncpy_from_user() here.

Joerg

-- 
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632


  parent reply	other threads:[~2009-06-02 13:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28 15:19 [PATCH 0/4] dma-debug: driver filter Joerg Roedel
2009-05-28 15:19 ` [PATCH 1/4] dma-debug: add variables and checks for " Joerg Roedel
2009-06-01 21:55   ` Andrew Morton
2009-06-02  8:27     ` Joerg Roedel
2009-05-28 15:19 ` [PATCH 2/4] dma-debug: add debugfs file " Joerg Roedel
2009-06-01 22:04   ` Andrew Morton
2009-06-02  8:55     ` Joerg Roedel
2009-06-02 13:33     ` Joerg Roedel [this message]
2009-05-28 15:19 ` [PATCH 3/4] dma-debug: add dma_debug_driver kernel command line Joerg Roedel
2009-06-01 22:08   ` Andrew Morton
2009-06-02  8:57     ` Joerg Roedel
2009-05-28 15:19 ` [PATCH 4/4] dma-debug: add documentation for the driver filter Joerg Roedel
  -- strict thread matches above, loose matches on Subject: below --
2009-06-02 14:36 [PATCH 0/4] dma-debug: driver filter v2 Joerg Roedel
2009-06-02 14:36 ` [PATCH 2/4] dma-debug: add debugfs file for driver filter Joerg Roedel

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=20090602133321.GA2231@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.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.