From: frank zago Date: Mon, 1 Sep 2014 15:39:14 +0000 (-0500) Subject: LU-5396 lnet/klnds: add sparse annotation __user wherever needed X-Git-Tag: 2.6.53~1 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=73c12f4d6c98476c0dc5de77a646a157db727eef LU-5396 lnet/klnds: add sparse annotation __user wherever needed This fixes sparse warnings such as: .../api-ni.c:1639:33: warning: incorrect type in argument 3 (different address spaces) .../api-ni.c:1639:33: expected struct lnet_process_id_t [noderef] [usertype] *ids .../api-ni.c:1639:33: got struct lnet_process_id_t [usertype] * There is no code change. Change-Id: I34620392863d622ea419e777f9e4110f26135853 Signed-off-by: frank zago Reviewed-on: http://review.whamcloud.com/11824 Reviewed-by: Bob Glossman Tested-by: Jenkins Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lnet/klnds/socklnd/socklnd_cb.c b/lnet/klnds/socklnd/socklnd_cb.c index 71ba3e4..5226620 100644 --- a/lnet/klnds/socklnd/socklnd_cb.c +++ b/lnet/klnds/socklnd/socklnd_cb.c @@ -131,7 +131,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx) LASSERT (tx->tx_niov > 0); if (nob < (int) iov->iov_len) { - iov->iov_base = (void *)((char *)iov->iov_base + nob); + iov->iov_base += nob; iov->iov_len -= nob; return (rc); } @@ -256,7 +256,7 @@ ksocknal_recv_iov (ksock_conn_t *conn) LASSERT (conn->ksnc_rx_niov > 0); - /* Never touch conn->ksnc_rx_iov or change connection + /* Never touch conn->ksnc_rx_iov or change connection * status inside ksocknal_lib_recv_iov */ rc = ksocknal_lib_recv_iov(conn); @@ -280,7 +280,7 @@ ksocknal_recv_iov (ksock_conn_t *conn) if (nob < (int)iov->iov_len) { iov->iov_len -= nob; - iov->iov_base = (void *)((char *)iov->iov_base + nob); + iov->iov_base += nob; return (-EAGAIN); } @@ -300,7 +300,7 @@ ksocknal_recv_kiov (ksock_conn_t *conn) int rc; LASSERT (conn->ksnc_rx_nkiov > 0); - /* Never touch conn->ksnc_rx_kiov or change connection + /* Never touch conn->ksnc_rx_kiov or change connection * status inside ksocknal_lib_recv_iov */ rc = ksocknal_lib_recv_kiov(conn); @@ -700,16 +700,16 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn) * ksnc_sock... */ LASSERT(!conn->ksnc_closing); - CDEBUG (D_NET, "Sending to %s ip %d.%d.%d.%d:%d\n", - libcfs_id2str(conn->ksnc_peer->ksnp_id), - HIPQUAD(conn->ksnc_ipaddr), - conn->ksnc_port); + CDEBUG(D_NET, "Sending to %s ip %d.%d.%d.%d:%d\n", + libcfs_id2str(conn->ksnc_peer->ksnp_id), + HIPQUAD(conn->ksnc_ipaddr), + conn->ksnc_port); ksocknal_tx_prep(conn, tx); /* Ensure the frags we've been given EXACTLY match the number of * bytes we want to send. Many TCP/IP stacks disregard any total - * size parameters passed to them and just look at the frags. + * size parameters passed to them and just look at the frags. * * We always expect at least 1 mapped fragment containing the * complete ksocknal message header. */ @@ -1491,7 +1491,7 @@ int ksocknal_scheduler(void *arg) spin_unlock_bh(&sched->kss_lock); if (!list_empty(&zlist)) { - /* free zombie noop txs, it's fast because + /* free zombie noop txs, it's fast because * noop txs are just put in freelist */ ksocknal_txlist_done(NULL, &zlist, 0); } @@ -1831,7 +1831,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn, if (ksocknal_invert_type(hello->kshm_ctype) != conn->ksnc_type) { CERROR ("Mismatched types: me %d, %s ip %u.%u.%u.%u %d\n", - conn->ksnc_type, libcfs_id2str(*peerid), + conn->ksnc_type, libcfs_id2str(*peerid), HIPQUAD(conn->ksnc_ipaddr), hello->kshm_ctype); return -EPROTO; diff --git a/lustre/fld/lproc_fld.c b/lustre/fld/lproc_fld.c index fd8ddf3..8dd6fe4 100644 --- a/lustre/fld/lproc_fld.c +++ b/lustre/fld/lproc_fld.c @@ -85,7 +85,7 @@ 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, +fld_proc_hash_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct lu_client_fld *fld = ((struct seq_file *)file->private_data)->private; @@ -118,7 +118,7 @@ fld_proc_hash_seq_write(struct file *file, const char *buffer, } static ssize_t -lprocfs_cache_flush_seq_write(struct file *file, const char *buffer, +lprocfs_cache_flush_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos) { struct lu_client_fld *fld = ((struct seq_file *)file->private_data)->private; diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 7db1275..44e4da2 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -658,12 +658,14 @@ extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name, /* Generic callbacks */ extern int lprocfs_u64_seq_show(struct seq_file *m, void *data); extern int lprocfs_atomic_seq_show(struct seq_file *m, void *data); -extern ssize_t lprocfs_atomic_seq_write(struct file *file, const char *buffer, +extern ssize_t lprocfs_atomic_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off); extern int lprocfs_uint_seq_show(struct seq_file *m, void *data); -extern ssize_t lprocfs_uint_seq_write(struct file *file, const char *buffer, +extern ssize_t lprocfs_uint_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off); -extern int lprocfs_wr_uint(struct file *file, const char *buffer, +extern int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data); extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data); extern int lprocfs_name_seq_show(struct seq_file *m, void *data); @@ -697,7 +699,7 @@ extern ssize_t lprocfs_ping_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); extern ssize_t -lprocfs_import_seq_write(struct file *file, const char *buffer, +lprocfs_import_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off); extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data); extern ssize_t @@ -712,16 +714,17 @@ extern int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data); extern int lprocfs_filestotal_seq_show(struct seq_file *m, void *data); extern int lprocfs_filesfree_seq_show(struct seq_file *m, void *data); -extern int lprocfs_write_helper(const char *buffer, unsigned long count, +extern int lprocfs_write_helper(const char __user *buffer, unsigned long count, int *val); -extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count, - int *val, int mult); +extern int lprocfs_write_frac_helper(const char __user *buffer, + unsigned long count, + int *val, int mult); extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult); extern int lprocfs_read_frac_helper(char *buffer, unsigned long count, long val, int mult); -extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count, - __u64 *val); -extern int lprocfs_write_frac_u64_helper(const char *buffer, +extern int lprocfs_write_u64_helper(const char __user *buffer, + unsigned long count, __u64 *val); +extern int lprocfs_write_frac_u64_helper(const char __user *buffer, unsigned long count, __u64 *val, int mult); char *lprocfs_find_named_value(const char *buffer, const char *name, @@ -798,7 +801,8 @@ struct file_operations name##_fops = { \ return lprocfs_##type##_seq_show(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_##type##_seq_write(file, buffer, \ @@ -808,7 +812,8 @@ struct file_operations name##_fops = { \ #define LPROC_SEQ_FOPS_WO_TYPE(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_##type##_seq_write(file, buffer, count, off);\ } \ @@ -854,9 +859,9 @@ lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); struct root_squash_info; -int lprocfs_wr_root_squash(const char *buffer, unsigned long count, +int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count, struct root_squash_info *squash, char *name); -int lprocfs_wr_nosquash_nids(const char *buffer, unsigned long count, +int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count, struct root_squash_info *squash, char *name); /* all quota proc functions */ @@ -1072,18 +1077,18 @@ lprocfs_evict_client_seq_write(struct file *file, const char *buffer, { return 0; } #endif static inline ssize_t -lprocfs_ping_seq_write(struct file *file, const char *buffer, +lprocfs_ping_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { return 0; } static inline ssize_t -lprocfs_import_seq_write(struct file *file, const char *buffer, +lprocfs_import_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { return 0; } static inline int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data) { return 0; } static inline ssize_t -lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer, +lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { return 0; } diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index db32d47..d9b5d96 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -267,7 +267,8 @@ typedef enum ldlm_policy_res ldlm_policy_res_t; struct __##var##__dummy_read {;} /* semicolon catcher */ #define LDLM_POOL_PROC_WRITER(var, type) \ - int lprocfs_wr_##var(struct file *file, const char *buffer, \ + int lprocfs_wr_##var(struct file *file, \ + const char __user *buffer, \ unsigned long count, void *data) \ { \ struct ldlm_pool *pl = data; \ diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c index ef15628..3af63a2 100644 --- a/lustre/ldlm/ldlm_pool.c +++ b/lustre/ldlm/ldlm_pool.c @@ -713,7 +713,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, +static ssize_t lprocfs_recalc_period_seq_write(struct file *file, + const char __user *buf, size_t len, loff_t *off) { struct seq_file *seq = file->private_data; diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index f0d1e66..188609a 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -73,7 +73,7 @@ unsigned int ldlm_dump_granted_max = 256; #ifdef LPROCFS static ssize_t -lprocfs_dump_ns_seq_write(struct file *file, const char *buffer, +lprocfs_dump_ns_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE); @@ -195,7 +195,8 @@ static int lprocfs_lru_size_seq_show(struct seq_file *m, void *v) return lprocfs_uint_seq_show(m, nr); } -static ssize_t lprocfs_lru_size_seq_write(struct file *file, const char *buffer, +static ssize_t lprocfs_lru_size_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; @@ -291,7 +292,8 @@ static int lprocfs_elc_seq_show(struct seq_file *m, void *v) return lprocfs_uint_seq_show(m, &supp); } -static ssize_t lprocfs_elc_seq_write(struct file *file, const char *buffer, +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; diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index cc2bfcc..18f80d1 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -208,7 +208,8 @@ static int ll_xattr_cache_seq_show(struct seq_file *m, void *v) return seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled); } -static ssize_t ll_xattr_cache_seq_write(struct file *file, const char *buffer, +static ssize_t ll_xattr_cache_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -259,7 +260,7 @@ static int ll_max_readahead_mb_seq_show(struct seq_file *m, void *v) } static ssize_t -ll_max_readahead_mb_seq_write(struct file *file, const char *buffer, +ll_max_readahead_mb_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -308,7 +309,8 @@ static int ll_max_readahead_per_file_mb_seq_show(struct seq_file *m, void *v) } static ssize_t -ll_max_readahead_per_file_mb_seq_write(struct file *file, const char *buffer, +ll_max_readahead_per_file_mb_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -351,7 +353,8 @@ static int ll_max_read_ahead_whole_mb_seq_show(struct seq_file *m, void *v) } static ssize_t -ll_max_read_ahead_whole_mb_seq_write(struct file *file, const char *buffer, +ll_max_read_ahead_whole_mb_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -524,7 +527,8 @@ static int ll_checksum_seq_show(struct seq_file *m, void *v) return seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0); } -static ssize_t ll_checksum_seq_write(struct file *file, const char *buffer, +static ssize_t ll_checksum_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -559,7 +563,8 @@ static int ll_max_rw_chunk_seq_show(struct seq_file *m, void *v) return seq_printf(m, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk); } -static ssize_t ll_max_rw_chunk_seq_write(struct file *file, const char *buffer, +static ssize_t ll_max_rw_chunk_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -588,8 +593,8 @@ static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type) } } -static int ll_wr_track_id(const char *buffer, unsigned long count, void *data, - enum stats_track_type type) +static int ll_wr_track_id(const char __user *buffer, unsigned long count, + void *data, enum stats_track_type type) { struct super_block *sb = data; int rc, pid; @@ -611,7 +616,8 @@ static int ll_track_pid_seq_show(struct seq_file *m, void *v) return ll_rd_track_id(m, STATS_TRACK_PID); } -static ssize_t ll_track_pid_seq_write(struct file *file, const char *buffer, +static ssize_t ll_track_pid_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *seq = file->private_data; @@ -624,7 +630,8 @@ static int ll_track_ppid_seq_show(struct seq_file *m, void *v) return ll_rd_track_id(m, STATS_TRACK_PPID); } -static ssize_t ll_track_ppid_seq_write(struct file *file, const char *buffer, +static ssize_t ll_track_ppid_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *seq = file->private_data; @@ -637,7 +644,8 @@ static int ll_track_gid_seq_show(struct seq_file *m, void *v) return ll_rd_track_id(m, STATS_TRACK_GID); } -static ssize_t ll_track_gid_seq_write(struct file *file, const char *buffer, +static ssize_t ll_track_gid_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *seq = file->private_data; @@ -653,7 +661,8 @@ static int ll_statahead_max_seq_show(struct seq_file *m, void *v) return seq_printf(m, "%u\n", sbi->ll_sa_max); } -static ssize_t ll_statahead_max_seq_write(struct file *file, const char *buffer, +static ssize_t ll_statahead_max_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -683,7 +692,8 @@ static int ll_statahead_agl_seq_show(struct seq_file *m, void *v) sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0); } -static ssize_t ll_statahead_agl_seq_write(struct file *file, const char *buffer, +static ssize_t ll_statahead_agl_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -727,7 +737,8 @@ static int ll_lazystatfs_seq_show(struct seq_file *m, void *v) (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0); } -static ssize_t ll_lazystatfs_seq_write(struct file *file, const char *buffer, +static ssize_t ll_lazystatfs_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c index de2a6f3..26461c7 100644 --- a/lustre/lmv/lproc_lmv.c +++ b/lustre/lmv/lproc_lmv.c @@ -92,8 +92,9 @@ static int lmv_placement_seq_show(struct seq_file *m, void *v) #define MAX_POLICY_STRING_SIZE 64 -static ssize_t lmv_placement_seq_write(struct file *file, const char *buffer, - size_t count, loff_t *off) +static ssize_t lmv_placement_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; char dummy[MAX_POLICY_STRING_SIZE + 1]; diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index 0f6e7a9..5250127 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -215,7 +215,7 @@ static int lod_qos_priofree_seq_show(struct seq_file *m, void *v) } static ssize_t -lod_qos_priofree_seq_write(struct file *file, const char *buffer, +lod_qos_priofree_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index 7786513..e8f9abb 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -54,7 +54,8 @@ static int lov_stripesize_seq_show(struct seq_file *m, void *v) return seq_printf(m, LPU64"\n", desc->ld_default_stripe_size); } -static ssize_t lov_stripesize_seq_write(struct file *file, const char *buffer, +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; @@ -84,7 +85,8 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v) return seq_printf(m, LPU64"\n", desc->ld_default_stripe_offset); } -static ssize_t lov_stripeoffset_seq_write(struct file *file, const char *buffer, +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; @@ -113,7 +115,8 @@ 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, +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; @@ -143,7 +146,8 @@ 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, +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; @@ -227,9 +231,9 @@ static void *lov_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos) static int lov_tgt_seq_show(struct seq_file *p, void *v) { struct lov_tgt_desc *tgt = v; - return seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_index, - obd_uuid2str(&tgt->ltd_uuid), - tgt->ltd_active ? "" : "IN"); + return seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_index, + obd_uuid2str(&tgt->ltd_uuid), + tgt->ltd_active ? "" : "IN"); } struct seq_operations lov_tgt_sops = { diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index 3a4570a..d6b9c26 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -55,7 +55,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) { diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index e38c39d..4717196 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -519,7 +519,7 @@ int lprocfs_uint_seq_show(struct seq_file *m, void *data) } EXPORT_SYMBOL(lprocfs_uint_seq_show); -int lprocfs_wr_uint(struct file *file, const char *buffer, +int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data) { unsigned *p = data; @@ -539,7 +539,7 @@ int lprocfs_wr_uint(struct file *file, const char *buffer, } EXPORT_SYMBOL(lprocfs_wr_uint); -ssize_t lprocfs_uint_seq_write(struct file *file, const char *buffer, +ssize_t lprocfs_uint_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { int *data = ((struct seq_file *)file->private_data)->private; @@ -569,7 +569,7 @@ int lprocfs_atomic_seq_show(struct seq_file *m, void *data) EXPORT_SYMBOL(lprocfs_atomic_seq_show); ssize_t -lprocfs_atomic_seq_write(struct file *file, const char *buffer, +lprocfs_atomic_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { atomic_t *atm = ((struct seq_file *)file->private_data)->private; @@ -1391,8 +1391,9 @@ void lprocfs_clear_stats(struct lprocfs_stats *stats) } EXPORT_SYMBOL(lprocfs_clear_stats); -static ssize_t lprocfs_stats_seq_write(struct file *file, const char *buf, - size_t len, loff_t *off) +static ssize_t lprocfs_stats_seq_write(struct file *file, + const char __user *buf, + size_t len, loff_t *off) { struct seq_file *seq = file->private_data; struct lprocfs_stats *stats = seq->private; @@ -1726,14 +1727,14 @@ __s64 lprocfs_read_helper(struct lprocfs_counter *lc, } EXPORT_SYMBOL(lprocfs_read_helper); -int lprocfs_write_helper(const char *buffer, unsigned long count, +int lprocfs_write_helper(const char __user *buffer, unsigned long count, int *val) { return lprocfs_write_frac_helper(buffer, count, val, 1); } EXPORT_SYMBOL(lprocfs_write_helper); -int lprocfs_write_frac_helper(const char *buffer, unsigned long count, +int lprocfs_write_frac_helper(const char __user *buffer, unsigned long count, int *val, int mult) { char kernbuf[20], *end, *pbuf; @@ -1856,14 +1857,16 @@ 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,__u64 *val) +int lprocfs_write_u64_helper(const char __user *buffer, unsigned long count, + __u64 *val) { return lprocfs_write_frac_u64_helper(buffer, count, val, 1); } EXPORT_SYMBOL(lprocfs_write_u64_helper); -int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count, - __u64 *val, int mult) +int lprocfs_write_frac_u64_helper(const char __user *buffer, + unsigned long count, + __u64 *val, int mult) { char kernbuf[22], *end, *pbuf; __u64 whole, frac = 0, units; diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 9dec3a5..4fe5d48 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -55,7 +55,8 @@ 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, +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; @@ -90,7 +91,7 @@ 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, + const char __user *buffer, size_t count, loff_t *off) { struct obd_device *dev = ((struct seq_file *)file->private_data)->private; @@ -134,7 +135,8 @@ 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, +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; @@ -253,7 +255,8 @@ 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, +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; @@ -310,7 +313,7 @@ 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, + const char __user *buffer, size_t count, loff_t *off) { struct obd_device *obd = ((struct seq_file *)file->private_data)->private; @@ -343,7 +346,8 @@ 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, +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; @@ -383,7 +387,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; @@ -422,7 +427,8 @@ 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, +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; @@ -449,7 +455,8 @@ 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, +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; @@ -467,7 +474,8 @@ 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, +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; @@ -492,7 +500,7 @@ 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, + const char __user *buffer, size_t count, loff_t *off) { struct obd_device *dev = ((struct seq_file *)file->private_data)->private; @@ -729,7 +737,8 @@ 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, +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; @@ -766,7 +775,8 @@ 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, +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; diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 840ea0c..08a2faa 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -286,7 +286,8 @@ 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, +ptlrpc_lprocfs_req_history_max_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -333,8 +334,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 seq_file *m = file->private_data; struct ptlrpc_service *svc = m->private; @@ -386,7 +388,8 @@ 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, +ptlrpc_lprocfs_threads_max_seq_write(struct file *file, + const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -640,7 +643,7 @@ out: * regular and high-priority (if the service has one) NRS head. */ static ssize_t -ptlrpc_lprocfs_nrs_seq_write(struct file *file, const char *buffer, +ptlrpc_lprocfs_nrs_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -1033,7 +1036,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, +ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; @@ -1211,8 +1214,8 @@ EXPORT_SYMBOL(lprocfs_ping_seq_write); * "echo connection=192.168.0.1@tcp0::instance > .../import". */ ssize_t -lprocfs_import_seq_write(struct file *file, const char *buffer, size_t count, - loff_t *off) +lprocfs_import_seq_write(struct file *file, const char __user *buffer, + size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct obd_device *obd = m->private;