提交 758d8e46 编写于 作者: P Phil Carmody 提交者: Artem Bityutskiy

UBI: eliminate possible undefined behaviour

The assignment to pos when rb is finally NULL is undefined behaviour.
Upon seeing that assignment, GCC may assume that rb is not NULL, and
the loop condition ``rb'' may be optimised away.
Signed-off-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 4a406856
...@@ -579,7 +579,8 @@ void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol, ...@@ -579,7 +579,8 @@ void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol,
for (rb = rb_first(root), \ for (rb = rb_first(root), \
pos = (rb ? container_of(rb, typeof(*pos), member) : NULL); \ pos = (rb ? container_of(rb, typeof(*pos), member) : NULL); \
rb; \ rb; \
rb = rb_next(rb), pos = container_of(rb, typeof(*pos), member)) rb = rb_next(rb), \
pos = (rb ? container_of(rb, typeof(*pos), member) : NULL))
/** /**
* ubi_zalloc_vid_hdr - allocate a volume identifier header object. * ubi_zalloc_vid_hdr - allocate a volume identifier header object.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册