The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=243b324f96686642177c8479c03288e2a6f68b50

commit 243b324f96686642177c8479c03288e2a6f68b50
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2021-05-03 16:43:29 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2021-05-03 17:24:30 +0000

    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
---
 sys/fs/devfs/devfs_vnops.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 043cee74fde2..40b80596523d 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -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);
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to