linux-yocto/fs/nfsd
NeilBrown 0722d804f7 nfsd: Replace clamp_t in nfsd4_get_drc_mem()
A recent change to clamp_t() in 6.1.y caused fs/nfsd/nfs4state.c to fail
to compile with gcc-9. The code in nfsd4_get_drc_mem() was written with
the assumption that when "max < min",

   clamp(val, min, max)

would return max.  This assumption is not documented as an API promise
and the change caused a compile failure if it could be statically
determined that "max < min".

The relevant code was no longer present upstream when commit 1519fbc883
("minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()")
landed there, so there is no upstream change to nfsd4_get_drc_mem() to
backport.

There is no clear case that the existing code in nfsd4_get_drc_mem()
is functioning incorrectly. The goal of this patch is to permit the clean
application of commit 1519fbc883 ("minmax.h: use BUILD_BUG_ON_MSG() for
the lo < hi test in clamp()"), and any commits that depend on it, to LTS
kernels without affecting the ability to compile those kernels. This is
done by open-coding the __clamp() macro sans the built-in type checking.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220745#c0
Signed-off-by: NeilBrown <neil@brown.name>
Stable-dep-of: 1519fbc883 ("minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed_by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-12-07 06:18:53 +09:00
..
acl.h
auth.c
auth.h
blocklayout.c NFSD: Fix last write offset handling in layoutcommit 2025-10-23 16:16:39 +02:00
blocklayoutxdr.c NFSD: Rework encoding and decoding of nfsd4_deviceid 2025-10-23 16:16:38 +02:00
blocklayoutxdr.h
cache.h
current_stateid.h
export.c nfsd: decouple the xprtsec policy check from check_nfsd_access() 2025-10-23 16:16:43 +02:00
export.h nfsd: decouple the xprtsec policy check from check_nfsd_access() 2025-10-23 16:16:43 +02:00
filecache.c
filecache.h
flexfilelayout.c NFSD: Define a proc_layoutcommit for the FlexFiles layout type 2025-10-23 16:16:41 +02:00
flexfilelayoutxdr.c NFSD: Rework encoding and decoding of nfsd4_deviceid 2025-10-23 16:16:38 +02:00
flexfilelayoutxdr.h
idmap.h
Kconfig
lockd.c nfsd: nfserr_jukebox in nlm_fopen should lead to a retry 2025-10-19 16:30:56 +02:00
Makefile
netns.h
nfs2acl.c
nfs3acl.c
nfs3proc.c
nfs3xdr.c
nfs4acl.c
nfs4callback.c
nfs4idmap.c
nfs4layouts.c NFSD: Rework encoding and decoding of nfsd4_deviceid 2025-10-23 16:16:38 +02:00
nfs4proc.c NFSD: Fix crash in nfsd4_read_release() 2025-11-24 10:29:10 +01:00
nfs4recover.c
nfs4state.c nfsd: Replace clamp_t in nfsd4_get_drc_mem() 2025-12-07 06:18:53 +09:00
nfs4xdr.c NFSD: Rework encoding and decoding of nfsd4_deviceid 2025-10-23 16:16:38 +02:00
nfscache.c
nfsctl.c
nfsd.h
nfsfh.c nfsd: decouple the xprtsec policy check from check_nfsd_access() 2025-10-23 16:16:43 +02:00
nfsfh.h
nfsproc.c
nfssvc.c
nfsxdr.c
pnfs.h
state.h
stats.c
stats.h
trace.c
trace.h
vfs.c
vfs.h
xdr.h
xdr3.h
xdr4.h NFSD: Rework encoding and decoding of nfsd4_deviceid 2025-10-23 16:16:38 +02:00
xdr4cb.h