[OpenWrt-Devel] [PATCH libubox 8/9] blobmsg_json: fix possible uninitialized struct member

Petr Štetiar ynezz at true.cz
Wed Nov 20 09:13:55 EST 2019

Yousong Zhou <yszhou4tech at gmail.com> [2019-11-20 22:03:06]:

> On Wed, 20 Nov 2019 at 20:01, Petr Štetiar <ynezz at true.cz> wrote:
> >
> > clang-10 analyzer reports following:
> >
> >  blobmsg_json.c:285:2: warning: The expression is an uninitialized value. The computed value will also be garbage
> >          s->indent_level++;
> >          ^~~~~~~~~~~~~~~~~
> Add else branch to initialize it in setup_strbuf() should suffice.

Of course, and I even initialy planned to fix it that way, but then decided to
just init the complete struct as it doesn't add another codepath.  So probably
just a matter of taste?

-- ynezz

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list