staging: lustre: fix sparse warning on LPROC_SEQ_FOPS macros
authorTristan Lelong <tristan@lelong.xyz>
Sat, 6 Dec 2014 06:43:20 +0000 (22:43 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2015 23:26:22 +0000 (15:26 -0800)
This patch fix a sparse warning in lustre sources

warning: incorrect type in argument 1 (different address spaces)
    expected void [noderef] <asn:1>*to
    got char *<noident>

This is done by adding the missing __user attribute on userland pointers inside the LPROC_SEQ_FOPS like macros:
- LPROC_SEQ_FOPS
- LPROC_SEQ_FOPS_RW_TYPE
- LPROC_SEQ_FOPS_WR_ONLY
- LDLM_POOL_PROC_WRITER

The patch also updates all the functions that are used by this macro:
- lprocfs_wr_*
- *_seq_write

as well as some helpers used by the previously modified functions (otherwise fixing the sparse warning add some new ones):
- lprocfs_write_frac_helper
- lprocfs_write_helper
- lprocfs_write_u64_helper

The patch also fixes one __user pointer direct dereference by strncmp in function fld_proc_hash_seq_write.

Signed-off-by: Tristan Lelong <tristan@lelong.xyz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/fld/lproc_fld.c
drivers/staging/lustre/lustre/include/lprocfs_status.h
drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
drivers/staging/lustre/lustre/lov/lproc_lov.c
drivers/staging/lustre/lustre/mdc/lproc_mdc.c
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
drivers/staging/lustre/lustre/osc/lproc_osc.c
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c

index 95e7de18d2f1771f12e6415f2c3f1080ce87d62c..74b4db9bc836cecee6288f5e6ed640000c783eaa 100644 (file)
@@ -87,13 +87,25 @@ fld_proc_hash_seq_show(struct seq_file *m, void *unused)
 }
 
 static ssize_t
-fld_proc_hash_seq_write(struct file *file, const char *buffer,
-                       size_t count, loff_t *off)
+fld_proc_hash_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct lu_client_fld *fld;
        struct lu_fld_hash *hash = NULL;
+       char *name;
        int i;
 
+       if (count > 80)
+               return -ENAMETOOLONG;
+
+       name = kmalloc(count, GFP_KERNEL);
+       if (!name)
+               return -ENOMEM;
+
+       if (copy_from_user(name, buffer, count) != 0)
+               return -EFAULT;
+
        fld = ((struct seq_file *)file->private_data)->private;
        LASSERT(fld != NULL);
 
@@ -101,7 +113,7 @@ fld_proc_hash_seq_write(struct file *file, const char *buffer,
                if (count != strlen(fld_hash[i].fh_name))
                        continue;
 
-               if (!strncmp(fld_hash[i].fh_name, buffer, count)) {
+               if (!strncmp(fld_hash[i].fh_name, name, count)) {
                        hash = &fld_hash[i];
                        break;
                }
@@ -116,6 +128,7 @@ fld_proc_hash_seq_write(struct file *file, const char *buffer,
                       fld->lcf_name, hash->fh_name);
        }
 
+       kfree(name);
        return count;
 }
 
index cfe503b7df628950847d7d8989b9556c10128e50..8a25cf6f6825be6bd58fbf476ea25a7250c56714 100644 (file)
@@ -627,16 +627,16 @@ struct adaptive_timeout;
 extern int lprocfs_at_hist_helper(struct seq_file *m,
                                  struct adaptive_timeout *at);
 extern int lprocfs_rd_timeouts(struct seq_file *m, void *data);
-extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
+extern int lprocfs_wr_timeouts(struct file *file, const char __user *buffer,
                               unsigned long count, void *data);
-extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
+extern int lprocfs_wr_evict_client(struct file *file, const char __user *buffer,
                            size_t count, loff_t *off);
-extern int lprocfs_wr_ping(struct file *file, const char *buffer,
+extern int lprocfs_wr_ping(struct file *file, const char __user *buffer,
                           size_t count, loff_t *off);
-extern int lprocfs_wr_import(struct file *file, const char *buffer,
+extern int lprocfs_wr_import(struct file *file, const char __user *buffer,
                      size_t count, loff_t *off);
 extern int lprocfs_rd_pinger_recov(struct seq_file *m, void *n);
-extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
+extern int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer,
                                   size_t count, loff_t *off);
 
 /* Statfs helpers */
@@ -650,8 +650,8 @@ extern int lprocfs_rd_filesfree(struct seq_file *m, void *data);
 extern int lprocfs_write_helper(const char __user *buffer, unsigned long count,
                                int *val);
 extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
-extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
-                                   __u64 *val);
+extern int lprocfs_write_u64_helper(const char __user *buffer,
+                               unsigned long count, __u64 *val);
 extern int lprocfs_write_frac_u64_helper(const char *buffer,
                                         unsigned long count,
                                         __u64 *val, int mult);
@@ -716,7 +716,8 @@ static struct file_operations name##_fops = {                               \
                return lprocfs_rd_##type(m, m->private);                \
        }                                                               \
        static ssize_t name##_##type##_seq_write(struct file *file,     \
-                       const char *buffer, size_t count, loff_t *off)  \
+                       const char __user *buffer, size_t count,        \
+                                               loff_t *off)            \
        {                                                               \
                struct seq_file *seq = file->private_data;              \
                return lprocfs_wr_##type(file, buffer,                  \
@@ -726,7 +727,8 @@ static struct file_operations name##_fops = {                               \
 
 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)                             \
        static ssize_t name##_##type##_write(struct file *file,         \
-                       const char *buffer, size_t count, loff_t *off)  \
+                       const char __user *buffer, size_t count,        \
+                                               loff_t *off)            \
        {                                                               \
                return lprocfs_wr_##type(file, buffer, count, off);     \
        }                                                               \
@@ -939,20 +941,24 @@ static inline int lprocfs_at_hist_helper(struct seq_file *m,
 static inline int lprocfs_rd_timeouts(struct seq_file *m, void *data)
 { return 0; }
 static inline int lprocfs_wr_timeouts(struct file *file,
-                                     const char *buffer,
-                                     unsigned long count, void *data)
+                               const char __user *buffer,
+                               unsigned long count, void *data)
 { return 0; }
-static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
-                                   size_t count, loff_t *off)
+static inline int lprocfs_wr_evict_client(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 { return 0; }
-static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
-                          size_t count, loff_t *off)
+static inline int lprocfs_wr_ping(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 { return 0; }
-static inline int lprocfs_wr_import(struct file *file, const char *buffer,
-                             size_t count, loff_t *off)
+static inline int lprocfs_wr_import(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 { return 0; }
-static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
-                                       size_t count, loff_t *off)
+static inline int lprocfs_wr_pinger_recov(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 { return 0; }
 
 /* Statfs helpers */
index 6c6c57ca91de8f5d96505941000d811bc98abaa5..20e64cddb1f4ef53a3da6381a14217a29d249677 100644 (file)
@@ -249,8 +249,9 @@ typedef enum ldlm_policy_res ldlm_policy_res_t;
        struct __##var##__dummy_read {; } /* semicolon catcher */
 
 #define LDLM_POOL_PROC_WRITER(var, type)                                   \
-       static int lprocfs_wr_##var(struct file *file, const char *buffer,  \
-                            unsigned long count, void *data)               \
+       static int lprocfs_wr_##var(struct file *file,                      \
+                               const char __user *buffer,                  \
+                               unsigned long count, void *data)            \
        {                                                                   \
                struct ldlm_pool *pl = data;                                \
                type tmp;                                                   \
index 4c838f615a64ec5d778fa28a8e760553211a09c6..142b3dd598cbf5c9a7d432b0a21a45de2c9f438d 100644 (file)
@@ -697,8 +697,8 @@ LPROC_SEQ_FOPS_RO(lprocfs_grant_plan);
 LDLM_POOL_PROC_READER_SEQ_SHOW(recalc_period, int);
 LDLM_POOL_PROC_WRITER(recalc_period, int);
 static ssize_t lprocfs_recalc_period_seq_write(struct file *file,
-                                              const char *buf, size_t len,
-                                              loff_t *off)
+                                              const char __user *buf,
+                                              size_t len, loff_t *off)
 {
        struct seq_file *seq = file->private_data;
 
index 1f150e46f50ee03771099555661f77f95e930f69..c6f62a91b233f280a8bb6956315b0185a1adf4fa 100644 (file)
@@ -72,7 +72,7 @@ extern unsigned int ldlm_cancel_unused_locks_before_replay;
 unsigned int ldlm_dump_granted_max = 256;
 
 #if defined(CONFIG_PROC_FS)
-static ssize_t lprocfs_wr_dump_ns(struct file *file, const char *buffer,
+static ssize_t lprocfs_wr_dump_ns(struct file *file, const char __user *buffer,
                                  size_t count, loff_t *off)
 {
        ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE);
@@ -287,8 +287,9 @@ static int lprocfs_elc_seq_show(struct seq_file *m, void *v)
        return lprocfs_rd_uint(m, &supp);
 }
 
-static ssize_t lprocfs_elc_seq_write(struct file *file, const char *buffer,
-                                size_t count, loff_t *off)
+static ssize_t lprocfs_elc_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
        unsigned int supp = -1;
index c993f25fb30305fcd0489f10576e6b8dff529958..c99f2f44ec62e2b69a25c6155550e4636263f337 100644 (file)
@@ -51,8 +51,9 @@ static int lov_stripesize_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%llu\n", desc->ld_default_stripe_size);
 }
 
-static ssize_t lov_stripesize_seq_write(struct file *file, const char *buffer,
-                                   size_t count, loff_t *off)
+static ssize_t lov_stripesize_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        struct lov_desc *desc;
@@ -81,8 +82,9 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%llu\n", desc->ld_default_stripe_offset);
 }
 
-static ssize_t lov_stripeoffset_seq_write(struct file *file, const char *buffer,
-                                     size_t count, loff_t *off)
+static ssize_t lov_stripeoffset_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        struct lov_desc *desc;
@@ -110,8 +112,9 @@ static int lov_stripetype_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%u\n", desc->ld_pattern);
 }
 
-static ssize_t lov_stripetype_seq_write(struct file *file, const char *buffer,
-                                   size_t count, loff_t *off)
+static ssize_t lov_stripetype_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        struct lov_desc *desc;
@@ -140,8 +143,9 @@ static int lov_stripecount_seq_show(struct seq_file *m, void *v)
                        (__s16)(desc->ld_default_stripe_count + 1) - 1);
 }
 
-static ssize_t lov_stripecount_seq_write(struct file *file, const char *buffer,
-                                    size_t count, loff_t *off)
+static ssize_t lov_stripecount_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        struct lov_desc *desc;
index 16341c81835857eb5bdbf9f0a407ccf2f04c2054..c420219c0a1457f463cbf5ccc7816fe853456e74 100644 (file)
@@ -52,7 +52,7 @@ static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
 }
 
 static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
-                                               const char *buffer,
+                                               const char __user *buffer,
                                                size_t count,
                                                loff_t *off)
 {
@@ -82,8 +82,9 @@ static int mdc_kuc_open(struct inode *inode, struct file *file)
 }
 
 /* temporary for testing */
-static ssize_t mdc_kuc_write(struct file *file, const char *buffer,
-                            size_t count, loff_t *off)
+static ssize_t mdc_kuc_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *obd =
                        ((struct seq_file *)file->private_data)->private;
index 66ceab20c743946364d91218a8b01aa1bdf5d90b..b5007b8cbe349c9949aeadacc7291019aff829bb 100644 (file)
@@ -272,8 +272,9 @@ static int obd_proc_jobid_var_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%s\n", obd_jobid_var);
 }
 
-static ssize_t obd_proc_jobid_var_seq_write(struct file *file, const char *buffer,
-                                       size_t count, loff_t *off)
+static ssize_t obd_proc_jobid_var_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        if (!count || count > JOBSTATS_JOBID_VAR_MAX_LEN)
                return -EINVAL;
index 3b7dfc367722f2b569d7706bb4b73343cc8a5f51..f78a241453290d69b33bfb7c450956c228d584b5 100644 (file)
@@ -1849,7 +1849,7 @@ int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult)
 }
 EXPORT_SYMBOL(lprocfs_seq_read_frac_helper);
 
-int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
+int lprocfs_write_u64_helper(const char __user *buffer, unsigned long count,
                             __u64 *val)
 {
        return lprocfs_write_frac_u64_helper(buffer, count, val, 1);
index 9f719bcecab39e7b806bd30a7607ba7d2d1427a2..8e22e45e45f305d1b2b99d52b2a75e92dfded61f 100644 (file)
@@ -53,8 +53,9 @@ static int osc_active_seq_show(struct seq_file *m, void *v)
        return rc;
 }
 
-static ssize_t osc_active_seq_write(struct file *file, const char *buffer,
-                                   size_t count, loff_t *off)
+static ssize_t osc_active_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        int val, rc;
@@ -88,7 +89,8 @@ static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
 }
 
 static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
-                       const char *buffer, size_t count, loff_t *off)
+                       const char __user *buffer,
+                       size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        struct client_obd *cli = &dev->u.cli;
@@ -130,8 +132,9 @@ static int osc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
        return lprocfs_seq_read_frac_helper(m, val, mult);
 }
 
-static ssize_t osc_max_dirty_mb_seq_write(struct file *file, const char *buffer,
-                                     size_t count, loff_t *off)
+static ssize_t osc_max_dirty_mb_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        struct client_obd *cli = &dev->u.cli;
@@ -233,8 +236,9 @@ static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
        return rc;
 }
 
-static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, const char *buffer,
-                                 size_t count, loff_t *off)
+static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
        struct client_obd *cli = &obd->u.cli;
@@ -290,7 +294,8 @@ static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)
 }
 
 static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
-                               const char *buffer, size_t count, loff_t *off)
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
        int val, rc;
@@ -322,8 +327,9 @@ static int osc_checksum_seq_show(struct seq_file *m, void *v)
                        obd->u.cli.cl_checksum ? 1 : 0);
 }
 
-static ssize_t osc_checksum_seq_write(struct file *file, const char *buffer,
-                          size_t count, loff_t *off)
+static ssize_t osc_checksum_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
        int val, rc;
@@ -362,7 +368,8 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
        return 0;
 }
 
-static ssize_t osc_checksum_type_seq_write(struct file *file, const char *buffer,
+static ssize_t osc_checksum_type_seq_write(struct file *file,
+                               const char __user *buffer,
                                size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -401,8 +408,9 @@ static int osc_resend_count_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
 }
 
-static ssize_t osc_resend_count_seq_write(struct file *file, const char *buffer,
-                              size_t count, loff_t *off)
+static ssize_t osc_resend_count_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
        int val, rc;
@@ -428,8 +436,9 @@ static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%u\n", od->od_contention_time);
 }
 
-static ssize_t osc_contention_seconds_seq_write(struct file *file, const char *buffer,
-                                    size_t count, loff_t *off)
+static ssize_t osc_contention_seconds_seq_write(struct file *file,
+                                       const char __user *buffer,
+                                       size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
        struct osc_device *od  = obd2osc_dev(obd);
@@ -447,8 +456,9 @@ static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
        return seq_printf(m, "%u\n", od->od_lockless_truncate);
 }
 
-static ssize_t osc_lockless_truncate_seq_write(struct file *file, const char *buffer,
-                                   size_t count, loff_t *off)
+static ssize_t osc_lockless_truncate_seq_write(struct file *file,
+                                       const char __user *buffer,
+                                       size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
        struct osc_device *od  = obd2osc_dev(obd);
@@ -472,7 +482,8 @@ static int osc_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *v)
 }
 
 static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
-                               const char *buffer, size_t count, loff_t *off)
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
        struct client_obd *cli = &dev->u.cli;
@@ -664,8 +675,9 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
 }
 #undef pct
 
-static ssize_t osc_rpc_stats_seq_write(struct file *file, const char *buf,
-                                      size_t len, loff_t *off)
+static ssize_t osc_rpc_stats_seq_write(struct file *file,
+                               const char __user *buf,
+                               size_t len, loff_t *off)
 {
        struct seq_file *seq = file->private_data;
        struct obd_device *dev = seq->private;
@@ -702,8 +714,9 @@ static int osc_stats_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static ssize_t osc_stats_seq_write(struct file *file, const char *buf,
-                                  size_t len, loff_t *off)
+static ssize_t osc_stats_seq_write(struct file *file,
+                               const char __user *buf,
+                               size_t len, loff_t *off)
 {
        struct seq_file *seq = file->private_data;
        struct obd_device *dev = seq->private;
index 4011e0050fcb42af018ee9be87c4ddaa5ed6be20..7b22afd0d8fde492d1e725efb4a125e2ec8e8ff4 100644 (file)
@@ -284,8 +284,9 @@ ptlrpc_lprocfs_req_history_max_seq_show(struct seq_file *m, void *n)
 }
 
 static ssize_t
-ptlrpc_lprocfs_req_history_max_seq_write(struct file *file, const char *buffer,
-                                        size_t count, loff_t *off)
+ptlrpc_lprocfs_req_history_max_seq_write(struct file *file,
+                                       const char __user *buffer,
+                                       size_t count, loff_t *off)
 {
        struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
        int                         bufpages;
@@ -329,8 +330,9 @@ ptlrpc_lprocfs_threads_min_seq_show(struct seq_file *m, void *n)
 }
 
 static ssize_t
-ptlrpc_lprocfs_threads_min_seq_write(struct file *file, const char *buffer,
-                                    size_t count, loff_t *off)
+ptlrpc_lprocfs_threads_min_seq_write(struct file *file,
+                                       const char __user *buffer,
+                                       size_t count, loff_t *off)
 {
        struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
        int     val;
@@ -381,8 +383,9 @@ ptlrpc_lprocfs_threads_max_seq_show(struct seq_file *m, void *n)
 }
 
 static ssize_t
-ptlrpc_lprocfs_threads_max_seq_write(struct file *file, const char *buffer,
-                                    size_t count, loff_t *off)
+ptlrpc_lprocfs_threads_max_seq_write(struct file *file,
+                               const char __user *buffer,
+                               size_t count, loff_t *off)
 {
        struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
        int     val;
@@ -1025,7 +1028,7 @@ static int ptlrpc_lprocfs_hp_ratio_seq_show(struct seq_file *m, void *v)
 }
 
 static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file,
-                                            const char *buffer,
+                                            const char __user *buffer,
                                             size_t count,
                                             loff_t *off)
 {
@@ -1175,7 +1178,7 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd);
 
 #define BUFLEN (UUID_MAX + 5)
 
-int lprocfs_wr_evict_client(struct file *file, const char *buffer,
+int lprocfs_wr_evict_client(struct file *file, const char __user *buffer,
                            size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -1223,7 +1226,7 @@ EXPORT_SYMBOL(lprocfs_wr_evict_client);
 
 #undef BUFLEN
 
-int lprocfs_wr_ping(struct file *file, const char *buffer,
+int lprocfs_wr_ping(struct file *file, const char __user *buffer,
                    size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -1251,7 +1254,7 @@ EXPORT_SYMBOL(lprocfs_wr_ping);
  * The connection UUID is a node's primary NID. For example,
  * "echo connection=192.168.0.1@tcp0::instance > .../import".
  */
-int lprocfs_wr_import(struct file *file, const char *buffer,
+int lprocfs_wr_import(struct file *file, const char __user *buffer,
                      size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
@@ -1329,7 +1332,7 @@ int lprocfs_rd_pinger_recov(struct seq_file *m, void *n)
 }
 EXPORT_SYMBOL(lprocfs_rd_pinger_recov);
 
-int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
+int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer,
                      size_t count, loff_t *off)
 {
        struct obd_device *obd = ((struct seq_file *)file->private_data)->private;