Re: NFSD: fix compile warning without CONFIG_NFSD_V3

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

 



On Mon, Jan 06, 2014 at 11:28:41AM +0800, Kinglong Mee wrote:
> Without CONFIG_NFSD_V3, compile will get warning as,
> 
> fs/nfsd/nfssvc.c: In function 'nfsd_svc':
> >> fs/nfsd/nfssvc.c:246:60: warning: array subscript is above array bounds [-Warray-bounds]
>         return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL);

Thanks, applying.

Though it might be simpler to define the array to always be length 4.

--b.

>                                                                ^
> 
> Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
> Signed-off-by: Kinglong Mee <kinglongmee@xxxxxxxxx>
> ---
>  fs/nfsd/nfssvc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index 55b5b57..9a4a5f9 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -243,7 +243,11 @@ static void nfsd_shutdown_generic(void)
>  
>  static bool nfsd_needs_lockd(void)
>  {
> +#if defined(CONFIG_NFSD_V3)
>  	return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL);
> +#else
> +	return (nfsd_versions[2] != NULL);
> +#endif
>  }
>  
>  static int nfsd_startup_net(int nrservs, struct net *net)
> -- 
> 1.8.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux