Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144564948
D35671.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35671.diff
View Options
diff --git a/sys/sys/tree.h b/sys/sys/tree.h
--- a/sys/sys/tree.h
+++ b/sys/sys/tree.h
@@ -462,6 +462,17 @@
attr void \
name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
{ \
+ /* \
+ * Initially, elm is a leaf. Either its parent was previously \
+ * a leaf, with two black null children, or an interior node \
+ * with a black non-null child and a red null child. The \
+ * balance criterion "the rank of any leaf is 1" precludes the \
+ * possibility of two red null children for the initial parent. \
+ * So the first loop iteration cannot lead to accessing an \
+ * uninitialized 'child', and a later iteration can only happen \
+ * when a value has been assigned to 'child' in the previous \
+ * one. \
+ */ \
struct type *child, *parent; \
while ((parent = RB_PARENT(elm, field)) != NULL) { \
if (RB_LEFT(parent, field) == elm) { \
@@ -477,6 +488,7 @@
} \
if (!RB_RED_RIGHT(elm, field)) { \
RB_FLIP_LEFT(elm, field); \
+ /* coverity[uninit_use] */ \
RB_ROTATE_LEFT(head, elm, child, field);\
if (RB_RED_LEFT(child, field)) \
RB_FLIP_RIGHT(elm, field); \
@@ -498,6 +510,7 @@
} \
if (!RB_RED_LEFT(elm, field)) { \
RB_FLIP_RIGHT(elm, field); \
+ /* coverity[uninit_use] */ \
RB_ROTATE_RIGHT(head, elm, child, field);\
if (RB_RED_RIGHT(child, field)) \
RB_FLIP_LEFT(elm, field); \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 10, 3:35 PM (12 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28627798
Default Alt Text
D35671.diff (1 KB)
Attached To
Mode
D35671: rb_tree: silence coverity
Attached
Detach File
Event Timeline
Log In to Comment