mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
devfs: Avoid comparison with an uninitialized var in devfs_fp_check()
devvn_refthread() will initialize *devp only if it succeeds, so check for success before comparing with fp->f_data. Other devvn_refthread() callers are careful to do this. Reported by: KMSAN Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30068
This commit is contained in:
parent
2b2d77e720
commit
243b324f96
@ -120,9 +120,8 @@ static int
|
||||
devfs_fp_check(struct file *fp, struct cdev **devp, struct cdevsw **dswp,
|
||||
int *ref)
|
||||
{
|
||||
|
||||
*dswp = devvn_refthread(fp->f_vnode, devp, ref);
|
||||
if (*devp != fp->f_data) {
|
||||
if (*dswp == NULL || *devp != fp->f_data) {
|
||||
if (*dswp != NULL)
|
||||
dev_relthread(*devp, *ref);
|
||||
return (ENXIO);
|
||||
|
Loading…
Reference in New Issue
Block a user