Skip to content

Commit

Permalink
lockd: fix decoder callback prototypes
Browse files Browse the repository at this point in the history
Declare the p_decode callbacks with the proper prototype instead of
casting to kxdrdproc_t and losing all type safety.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Acked-by: Trond Myklebust <[email protected]>
  • Loading branch information
Christoph Hellwig committed May 15, 2017
1 parent d39916c commit 1fa2339
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 5 additions & 3 deletions fs/lockd/clnt4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,9 @@ static int decode_nlm4_testrply(struct xdr_stream *xdr,

static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nlm_res *result)
void *data)
{
struct nlm_res *result = data;
int error;

error = decode_cookie(xdr, &result->cookie);
Expand All @@ -553,8 +554,9 @@ static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
*/
static int nlm4_xdr_dec_res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nlm_res *result)
void *data)
{
struct nlm_res *result = data;
int error;

error = decode_cookie(xdr, &result->cookie);
Expand All @@ -575,7 +577,7 @@ static int nlm4_xdr_dec_res(struct rpc_rqst *req,
[NLMPROC_##proc] = { \
.p_proc = NLMPROC_##proc, \
.p_encode = nlm4_xdr_enc_##argtype, \
.p_decode = (kxdrdproc_t)nlm4_xdr_dec_##restype, \
.p_decode = nlm4_xdr_dec_##restype, \
.p_arglen = NLM4_##argtype##_sz, \
.p_replen = NLM4_##restype##_sz, \
.p_statidx = NLMPROC_##proc, \
Expand Down
8 changes: 5 additions & 3 deletions fs/lockd/clntxdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,9 @@ static int decode_nlm_testrply(struct xdr_stream *xdr,

static int nlm_xdr_dec_testres(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nlm_res *result)
void *data)
{
struct nlm_res *result = data;
int error;

error = decode_cookie(xdr, &result->cookie);
Expand All @@ -551,8 +552,9 @@ static int nlm_xdr_dec_testres(struct rpc_rqst *req,
*/
static int nlm_xdr_dec_res(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nlm_res *result)
void *data)
{
struct nlm_res *result = data;
int error;

error = decode_cookie(xdr, &result->cookie);
Expand All @@ -573,7 +575,7 @@ static int nlm_xdr_dec_res(struct rpc_rqst *req,
[NLMPROC_##proc] = { \
.p_proc = NLMPROC_##proc, \
.p_encode = nlm_xdr_enc_##argtype, \
.p_decode = (kxdrdproc_t)nlm_xdr_dec_##restype, \
.p_decode = nlm_xdr_dec_##restype, \
.p_arglen = NLM_##argtype##_sz, \
.p_replen = NLM_##restype##_sz, \
.p_statidx = NLMPROC_##proc, \
Expand Down
10 changes: 6 additions & 4 deletions fs/lockd/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,

static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nsm_res *resp)
void *data)
{
struct nsm_res *resp = data;
__be32 *p;

p = xdr_inline_decode(xdr, 4 + 4);
Expand All @@ -507,8 +508,9 @@ static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,

static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nsm_res *resp)
void *data)
{
struct nsm_res *resp = data;
__be32 *p;

p = xdr_inline_decode(xdr, 4);
Expand All @@ -533,7 +535,7 @@ static struct rpc_procinfo nsm_procedures[] = {
[NSMPROC_MON] = {
.p_proc = NSMPROC_MON,
.p_encode = nsm_xdr_enc_mon,
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res,
.p_decode = nsm_xdr_dec_stat_res,
.p_arglen = SM_mon_sz,
.p_replen = SM_monres_sz,
.p_statidx = NSMPROC_MON,
Expand All @@ -542,7 +544,7 @@ static struct rpc_procinfo nsm_procedures[] = {
[NSMPROC_UNMON] = {
.p_proc = NSMPROC_UNMON,
.p_encode = nsm_xdr_enc_unmon,
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat,
.p_decode = nsm_xdr_dec_stat,
.p_arglen = SM_mon_id_sz,
.p_replen = SM_unmonres_sz,
.p_statidx = NSMPROC_UNMON,
Expand Down

0 comments on commit 1fa2339

Please sign in to comment.