Powered by Linux
Re: False positive due to MACROs in nfsd code — Semantic Matching Tool

Re: False positive due to MACROs in nfsd code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 05, 2024 at 11:51:01AM +0530, Harshit Mogalapalli wrote:
> Hi,
> 
> 
> fs/nfsd/nfs4xdr.c:639 nfsd4_decode_close() warn: ignoring unreachable code.
> 
> 
> 
>  630 static __be32
>  631 nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close
> *close)
>  632 {
>  633         DECODE_HEAD;
>  634
>  635         READ_BUF(4);
>  636         close->cl_seqid = be32_to_cpup(p++);
>  637         return nfsd4_decode_stateid(argp, &close->cl_stateid);
>  638
>  639         DECODE_TAIL;
>  640 }

This is not what the code looks like in today's linux-next so I can't
test it but you could just add DECODE_TAIL to
smatch_data/kernel.unreachable.ignore

regards,
dan carpenter

> 
>  131 /* READ_BUF, read_buf(): nbytes must be <= PAGE_SIZE */
>  132 #define READ_BUF(nbytes)  do {                  \
>  133         if (nbytes <= (u32)((char *)argp->end - (char *)argp->p)) {
> \
>  134                 p = argp->p;                    \
>  135                 argp->p += XDR_QUADLEN(nbytes); \
>  136         } else if (!(p = read_buf(argp, nbytes))) { \
>  137                 dprintk("NFSD: xdr error (%s:%d)\n", \
>  138                                 __FILE__, __LINE__); \
>  139                 goto xdr_error;                 \
>  140         }                                       \
>  141 } while (0)
>  142
> 
> 
> Thought: I think we should tell mark all macro content to do inlining ? so
> it could see the goto xdr_error, I don't really know how smatch reads it
> 
> 
> Thanks,
> Harshit
> 




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux