lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* put_ulong calls in lib_ring_buffer_compat_ioctl() should be compat?
@ 2012-12-11 22:17 Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2012-12-11 22:17 UTC (permalink / raw)
  To: lttng-dev

I was noticing the that some of the put_ulong calls in 
lib_ring_buffer_compat_ioctl() were not compat_put_ulong.  I can't 
imagine this is correct.  Here's a patch to fix it, assuming that is 
wrong.  It seems to work ok.

diff --git a/lib/ringbuffer/ring_buffer_vfs.c 
b/lib/ringbuffer/ring_buffer_vfs.c
index c69b64e..899af81 100644
--- a/lib/ringbuffer/ring_buffer_vfs.c
+++ b/lib/ringbuffer/ring_buffer_vfs.c
@@ -331,7 +331,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, 
unsigned int cmd,
          data_size = lib_ring_buffer_get_read_data_size(config, buf);
          if (data_size > UINT_MAX)
              return -EFBIG;
-        return put_ulong(data_size, arg);
+        return compat_put_ulong(data_size, arg);
      }
      case RING_BUFFER_COMPAT_GET_PADDED_SUBBUF_SIZE:
      {
@@ -341,12 +341,12 @@ long lib_ring_buffer_compat_ioctl(struct file 
*filp, unsigned int cmd,
          size = PAGE_ALIGN(size);
          if (size > UINT_MAX)
              return -EFBIG;
-        return put_ulong(size, arg);
+        return compat_put_ulong(size, arg);
      }
      case RING_BUFFER_COMPAT_GET_MAX_SUBBUF_SIZE:
          if (chan->backend.subbuf_size > UINT_MAX)
              return -EFBIG;
-        return put_ulong(chan->backend.subbuf_size, arg);
+        return compat_put_ulong(chan->backend.subbuf_size, arg);
      case RING_BUFFER_COMPAT_GET_MMAP_LEN:
      {
          unsigned long mmap_buf_len;
@@ -358,7 +358,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, 
unsigned int cmd,
              mmap_buf_len += chan->backend.subbuf_size;
          if (mmap_buf_len > UINT_MAX)
              return -EFBIG;
-        return put_ulong(mmap_buf_len, arg);
+        return compat_put_ulong(mmap_buf_len, arg);
      }
      case RING_BUFFER_COMPAT_GET_MMAP_READ_OFFSET:
      {
@@ -371,7 +371,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, 
unsigned int cmd,
          read_offset = buf->backend.array[sb_bindex]->mmap_offset;
          if (read_offset > UINT_MAX)
              return -EINVAL;
-        return put_ulong(read_offset, arg);
+        return compat_put_ulong(read_offset, arg);
      }
      case RING_BUFFER_COMPAT_FLUSH:
          lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: put_ulong calls in lib_ring_buffer_compat_ioctl() should be compat?
       [not found] <50C7B110.3040009@acm.org>
@ 2012-12-12  2:47 ` Mathieu Desnoyers
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2012-12-12  2:47 UTC (permalink / raw)
  To: minyard; +Cc: lttng-dev

* Corey Minyard (tcminyard@gmail.com) wrote:
> I was noticing the that some of the put_ulong calls in  
> lib_ring_buffer_compat_ioctl() were not compat_put_ulong.  I can't  
> imagine this is correct.  Here's a patch to fix it, assuming that is  
> wrong.  It seems to work ok.

Merged, thanks!

Mathieu

>
> diff --git a/lib/ringbuffer/ring_buffer_vfs.c  
> b/lib/ringbuffer/ring_buffer_vfs.c
> index c69b64e..899af81 100644
> --- a/lib/ringbuffer/ring_buffer_vfs.c
> +++ b/lib/ringbuffer/ring_buffer_vfs.c
> @@ -331,7 +331,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp,  
> unsigned int cmd,
>          data_size = lib_ring_buffer_get_read_data_size(config, buf);
>          if (data_size > UINT_MAX)
>              return -EFBIG;
> -        return put_ulong(data_size, arg);
> +        return compat_put_ulong(data_size, arg);
>      }
>      case RING_BUFFER_COMPAT_GET_PADDED_SUBBUF_SIZE:
>      {
> @@ -341,12 +341,12 @@ long lib_ring_buffer_compat_ioctl(struct file  
> *filp, unsigned int cmd,
>          size = PAGE_ALIGN(size);
>          if (size > UINT_MAX)
>              return -EFBIG;
> -        return put_ulong(size, arg);
> +        return compat_put_ulong(size, arg);
>      }
>      case RING_BUFFER_COMPAT_GET_MAX_SUBBUF_SIZE:
>          if (chan->backend.subbuf_size > UINT_MAX)
>              return -EFBIG;
> -        return put_ulong(chan->backend.subbuf_size, arg);
> +        return compat_put_ulong(chan->backend.subbuf_size, arg);
>      case RING_BUFFER_COMPAT_GET_MMAP_LEN:
>      {
>          unsigned long mmap_buf_len;
> @@ -358,7 +358,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp,  
> unsigned int cmd,
>              mmap_buf_len += chan->backend.subbuf_size;
>          if (mmap_buf_len > UINT_MAX)
>              return -EFBIG;
> -        return put_ulong(mmap_buf_len, arg);
> +        return compat_put_ulong(mmap_buf_len, arg);
>      }
>      case RING_BUFFER_COMPAT_GET_MMAP_READ_OFFSET:
>      {
> @@ -371,7 +371,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp,  
> unsigned int cmd,
>          read_offset = buf->backend.array[sb_bindex]->mmap_offset;
>          if (read_offset > UINT_MAX)
>              return -EINVAL;
> -        return put_ulong(read_offset, arg);
> +        return compat_put_ulong(read_offset, arg);
>      }
>      case RING_BUFFER_COMPAT_FLUSH:
>          lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-12  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-11 22:17 put_ulong calls in lib_ring_buffer_compat_ioctl() should be compat? Corey Minyard
     [not found] <50C7B110.3040009@acm.org>
2012-12-12  2:47 ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).