Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: johannes@sipsolutions.net (Johannes Berg)
Subject: [PATCH 1/4] devcoredump: use memory_read_from_buffer
Date: Thu, 02 May 2019 14:42:49 +0200	[thread overview]
Message-ID: <e5cfeb7ad11b3783239e05ab7414fcec28dce1b5.camel@sipsolutions.net> (raw)
In-Reply-To: <1556787561-5113-2-git-send-email-akinobu.mita@gmail.com> (sfid-20190502_105940_876596_E74F58C8)

On Thu, 2019-05-02@17:59 +0900, Akinobu Mita wrote:
> Use memory_read_from_buffer() to simplify devcd_readv().

Reviewed-by: Johannes Berg <johannes at sipsolutions.net>

> Cc: Johannes Berg <johannes at sipsolutions.net>
> Cc: Keith Busch <keith.busch at intel.com>
> Cc: Jens Axboe <axboe at fb.com>
> Cc: Christoph Hellwig <hch at lst.de>
> Cc: Sagi Grimberg <sagi at grimberg.me>
> Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
> ---
>  drivers/base/devcoredump.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
> index f1a3353..3c960a6 100644
> --- a/drivers/base/devcoredump.c
> +++ b/drivers/base/devcoredump.c
> @@ -164,16 +164,7 @@ static struct class devcd_class = {
>  static ssize_t devcd_readv(char *buffer, loff_t offset, size_t count,
>  			   void *data, size_t datalen)
>  {
> -	if (offset > datalen)
> -		return -EINVAL;
> -
> -	if (offset + count > datalen)
> -		count = datalen - offset;
> -
> -	if (count)
> -		memcpy(buffer, ((u8 *)data) + offset, count);
> -
> -	return count;
> +	return memory_read_from_buffer(buffer, count, &offset, data, datalen);
>  }
>  
>  static void devcd_freev(void *data)

  reply	other threads:[~2019-05-02 12:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02  8:59 [PATCH 0/4] nvme-pci: support device coredump Akinobu Mita
2019-05-02  8:59 ` [PATCH 1/4] devcoredump: use memory_read_from_buffer Akinobu Mita
2019-05-02 12:42   ` Johannes Berg [this message]
2019-05-02  8:59 ` [PATCH 2/4] devcoredump: allow to create several coredump files in one device Akinobu Mita
2019-05-02 12:47   ` Johannes Berg
2019-05-03  3:41     ` Akinobu Mita
2019-05-02  8:59 ` [PATCH 3/4] nvme-pci: add device coredump support Akinobu Mita
2019-05-04 10:04   ` Minwoo Im
2019-05-04 14:26     ` Akinobu Mita
2019-05-04 14:38       ` Minwoo Im
2019-05-04 14:46         ` Minwoo Im
2019-05-02  8:59 ` [PATCH 4/4] nvme-pci: trigger device coredump before resetting controller Akinobu Mita
2019-05-02 12:57 ` [PATCH 0/4] nvme-pci: support device coredump Keith Busch
2019-05-03  3:38   ` Akinobu Mita
2019-05-03 12:12     ` Keith Busch
2019-05-03 12:20       ` Christoph Hellwig
2019-05-04  4:20         ` Akinobu Mita
2019-05-04  9:40           ` Minwoo Im
2019-05-04 14:36             ` Akinobu Mita

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=e5cfeb7ad11b3783239e05ab7414fcec28dce1b5.camel@sipsolutions.net \
    --to=johannes@sipsolutions.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox