Hi!

This makes these array derefs consistent with the others in the file.
Also I believe this is the preferred way to do this.

Best,

Martin

Index: kern_unveil.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_unveil.c,v
retrieving revision 1.39
diff -u -p -r1.39 kern_unveil.c
--- kern_unveil.c       22 Mar 2020 20:23:36 -0000      1.39
+++ kern_unveil.c       4 Apr 2020 17:08:00 -0000
@@ -204,7 +204,7 @@ unveil_destroy(struct process *ps)
        size_t i;
 
        for (i = 0; ps->ps_uvpaths != NULL && i < ps->ps_uvvcount; i++) {
-               struct unveil *uv = ps->ps_uvpaths + i;
+               struct unveil *uv = &ps->ps_uvpaths[i];
 
                struct vnode *vp = uv->uv_vp;
                /* skip any vnodes zapped by unveil_removevnode */
@@ -244,8 +244,8 @@ unveil_copy(struct process *parent, stru
        child->ps_uvncount = 0;
        for (i = 0; parent->ps_uvpaths != NULL && i < parent->ps_uvvcount;
             i++) {
-               struct unveil *from = parent->ps_uvpaths + i;
-               struct unveil *to = child->ps_uvpaths + i;
+               struct unveil *from = &parent->ps_uvpaths[i];
+               struct unveil *to = &child->ps_uvpaths[i];
                struct unvname *unvn, *next;
 
                to->uv_vp = from->uv_vp;
@@ -267,8 +267,8 @@ unveil_copy(struct process *parent, stru
        }
        child->ps_uvvcount = parent->ps_uvvcount;
        if (parent->ps_uvpcwd)
-               child->ps_uvpcwd = child->ps_uvpaths +
-                   (parent->ps_uvpcwd - parent->ps_uvpaths);
+               child->ps_uvpcwd =
+                   &child->ps_uvpaths[parent->ps_uvpcwd - parent->ps_uvpaths];
        child->ps_uvdone = parent->ps_uvdone;
        child->ps_uvshrink = parent->ps_uvshrink;
 }

Reply via email to