Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.6.0
    • None
    • None
    • 3
    • 10991

    Description

      Found by Thomas Meyer <thomas@m3y3r.de> and submitted to mainline kernel:

      Author: Thomas Meyer <thomas@m3y3r.de>
      Date:   Thu Sep 19 23:45:46 2013 +0200
      
          staging: lustre: Cocci spatch "noderef"
          
          sizeof when applied to a pointer typed expression gives the size of the
          pointer.
          Found by coccinelle spatch "misc/noderef.cocci"
          
          Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
          Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/stagi
      index 2644edf..c8b4344 100644
      --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
      +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
      @@ -1387,7 +1387,7 @@ echo_copyout_lsm (struct lov_stripe_md *lsm, void *_ulsm, 
              if (nob > ulsm_nob)
                      return (-EINVAL);
       
      -       if (copy_to_user (ulsm, lsm, sizeof(ulsm)))
      +       if (copy_to_user (ulsm, lsm, sizeof(*ulsm)))
                      return (-EFAULT);
      

      Attachments

        Activity

          [LU-4088] echo_copyout_lsm wrong copy size
          green Oleg Drokin added a comment -

          patch landed

          green Oleg Drokin added a comment - patch landed
          jhammond John Hammond added a comment -

          There's probably another in the gss userspace code:

          diff -u -p lustre/utils/gss/write_bytes.h /tmp/nothing/utils/gss/write_bytes.h
          --- lustre/utils/gss/write_bytes.h
          +++ /tmp/nothing/utils/gss/write_bytes.h
          @@ -111,7 +111,6 @@ get_buffer(char **ptr, const char *end,
           static inline int
           xdr_get_u32(u_int32_t **ptr, const u_int32_t *end, u_int32_t *res)
           {
          -       if (get_bytes((char **)ptr, (char *)end, res, sizeof(res)))
                     return -1;
                     *res = ntohl(*res);
                     return 0;
          
          jhammond John Hammond added a comment - There's probably another in the gss userspace code: diff -u -p lustre/utils/gss/write_bytes.h /tmp/nothing/utils/gss/write_bytes.h --- lustre/utils/gss/write_bytes.h +++ /tmp/nothing/utils/gss/write_bytes.h @@ -111,7 +111,6 @@ get_buffer(char **ptr, const char *end, static inline int xdr_get_u32(u_int32_t **ptr, const u_int32_t *end, u_int32_t *res) { - if (get_bytes((char **)ptr, (char *)end, res, sizeof(res))) return -1; *res = ntohl(*res); return 0;
          green Oleg Drokin added a comment - patch in http://review.whamcloud.com/7922

          People

            wc-triage WC Triage
            green Oleg Drokin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: