Skip to content

Commit 3a237b4

Browse files
committed
NFSD: Make nfsd4_ops::opnum a u32
Avoid passing a "pointer to int" argument to xdr_stream_decode_u32. Signed-off-by: Chuck Lever <[email protected]>
1 parent 2212036 commit 3a237b4

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3282,7 +3282,7 @@ int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op)
32823282
void warn_on_nonidempotent_op(struct nfsd4_op *op)
32833283
{
32843284
if (OPDESC(op)->op_flags & OP_MODIFIES_SOMETHING) {
3285-
pr_err("unable to encode reply to nonidempotent op %d (%s)\n",
3285+
pr_err("unable to encode reply to nonidempotent op %u (%s)\n",
32863286
op->opnum, nfsd4_op_name(op->opnum));
32873287
WARN_ON_ONCE(1);
32883288
}

fs/nfsd/nfs4xdr.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,9 +2419,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
24192419
op = &argp->ops[i];
24202420
op->replay = NULL;
24212421

2422-
READ_BUF(4);
2423-
op->opnum = be32_to_cpup(p++);
2424-
2422+
if (xdr_stream_decode_u32(argp->xdr, &op->opnum) < 0)
2423+
return nfserr_bad_xdr;
24252424
if (nfsd4_opnum_in_range(argp, op)) {
24262425
op->status = nfsd4_dec_ops[op->opnum](argp, &op->u);
24272426
if (op->status != nfs_ok)
@@ -5378,7 +5377,7 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
53785377
if (op->status && opdesc &&
53795378
!(opdesc->op_flags & OP_NONTRIVIAL_ERROR_ENCODE))
53805379
goto status;
5381-
BUG_ON(op->opnum < 0 || op->opnum >= ARRAY_SIZE(nfsd4_enc_ops) ||
5380+
BUG_ON(op->opnum >= ARRAY_SIZE(nfsd4_enc_ops) ||
53825381
!nfsd4_enc_ops[op->opnum]);
53835382
encoder = nfsd4_enc_ops[op->opnum];
53845383
op->status = encoder(resp, op->status, &op->u);

fs/nfsd/xdr4.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ struct nfsd4_copy_notify {
615615
};
616616

617617
struct nfsd4_op {
618-
int opnum;
618+
u32 opnum;
619619
const struct nfsd4_operation * opdesc;
620620
__be32 status;
621621
union nfsd4_op_u {

0 commit comments

Comments
 (0)