Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/common/include/linux Fix hlist iteration ag...



details:   https://anonhg.NetBSD.org/src/rev/058fb67b50d2
branches:  trunk
changeset: 365829:058fb67b50d2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 06:54:19 2018 +0000

description:
Fix hlist iteration again with more fields and null checks.

diffstat:

 sys/external/bsd/common/include/linux/list.h |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r a277557e4d40 -r 058fb67b50d2 sys/external/bsd/common/include/linux/list.h
--- a/sys/external/bsd/common/include/linux/list.h      Mon Aug 27 06:54:08 2018 +0000
+++ b/sys/external/bsd/common/include/linux/list.h      Mon Aug 27 06:54:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: list.h,v 1.8 2018/08/27 06:51:38 riastradh Exp $       */
+/*     $NetBSD: list.h,v 1.9 2018/08/27 06:54:19 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -296,7 +296,7 @@
                        hlist_entry(hlist_first(HEAD), typeof(*(VAR)),        \
                            FIELD));                                          \
                (VAR) != NULL;                                                \
-               (VAR) = (hlist_next(VAR) == NULL ? NULL :                     \
+               (VAR) = (hlist_next(&(VAR)->FIELD) == NULL ? NULL :           \
                        hlist_entry(hlist_next(&(VAR)->FIELD), typeof(*(VAR)),\
                            FIELD)))
 
@@ -305,8 +305,9 @@
                        hlist_entry(hlist_first(HEAD), typeof(*(VAR)),        \
                            FIELD)),                                          \
                    (NEXT) = ((VAR) == NULL ? NULL :                          \
-                       hlist_entry(hlist_next(&(VAR)->FIELD), typeof(*(VAR)),\
-                           FIELD));                                          \
+                       hlist_next(&(VAR)->FIELD) == NULL ? NULL :            \
+                           hlist_entry(hlist_next(&(VAR)->FIELD),            \
+                               typeof(*(VAR)), FIELD));                      \
                (VAR) != NULL;                                                \
                (VAR) = (NEXT))
 



Home | Main Index | Thread Index | Old Index