All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Matan Barak <matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Eran Ben Elisha <eranbe-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH for-next V1 2/5] IB/core: Add ib_is_udata_cleared
Date: Tue, 15 Dec 2015 16:13:55 +0200	[thread overview]
Message-ID: <56702023.5080307@mellanox.com> (raw)
In-Reply-To: <CAAKD3BBKu493f539h+SfG=JLgW-OKrsUZ8FhZPHy598n6+j4=Q@mail.gmail.com>

On 14/12/2015 18:31, Matan Barak wrote:
> I'm not sure regarding the string.c location, as it deals with user
> buffers, but in order not to
> be dependent on this, I'll change this code to the following.
> 
> static inline bool ib_is_udata_cleared(struct ib_udata *udata,
>                                        u8 cleared_char,
>                                        size_t offset,
>                                        size_t len)
> {
>         const void __user *p = udata->inbuf + offset;
>         bool ret = false;
>         u8 *buf;
> 
>         if (len > USHRT_MAX)
>                 return false;
> 
>         buf = kmalloc(len, GFP_KERNEL);
>         if (!buf)
>                 return false;
> 
>         if (copy_from_user(buf, p, len))
>                 goto free;
> 
>         ret = !memchr_inv(buf, cleared_char, len);
> 
> free:
>         kfree(buf);
>         return ret;
> }

Looks good to me.

Thanks,
Haggai

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-12-15 14:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 15:44 [PATCH for-next V1 0/5] User-space time-stamping support for mlx5_ib Matan Barak
     [not found] ` <1449157463-25313-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-03 15:44   ` [PATCH for-next V1 1/5] IB/mlx5: Add create_cq extended command Matan Barak
2015-12-03 15:44   ` [PATCH for-next V1 2/5] IB/core: Add ib_is_udata_cleared Matan Barak
     [not found]     ` <1449157463-25313-3-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-07 13:18       ` Haggai Eran
     [not found]         ` <56658718.8080308-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-10 14:59           ` Matan Barak
     [not found]             ` <CAAKD3BC7bhKC+jKV3aH9W+pcBwV19PJZYwXdZue6hNew=CJW9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-10 15:20               ` Haggai Eran
     [not found]                 ` <5669983E.5000200-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-10 17:29                   ` Matan Barak
     [not found]                     ` <CAAKD3BDfobwroOnvoxPMTA5zL=wxY3KDL=FAvq5EdUOkFG_F+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-13 15:47                       ` Haggai Eran
     [not found]                         ` <566D9315.9050807-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-14 16:31                           ` Matan Barak
2015-12-15 14:13                             ` Haggai Eran [this message]
2015-12-03 15:44   ` [PATCH for-next V1 3/5] IB/mlx5: Add support for hca_core_clock and timestamp_mask Matan Barak
2015-12-03 15:44   ` [PATCH for-next V1 4/5] IB/mlx5: Add hca_core_clock_offset to udata in init_ucontext Matan Barak
2015-12-03 15:44   ` [PATCH for-next V1 5/5] IB/mlx5: Mmap the HCA's core clock register to user-space Matan Barak

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=56702023.5080307@mellanox.com \
    --to=haggaie-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=eranbe-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.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.