Skip to contentSkip to conversation

drbd: replace genl_magic with explicit netlink serialization

bug report Dan Carpenter 1 participant 1 message May 19 Block layer

lore
Share & tools
lore
#0 lore raw

Hello Christoph Böhmwalder,

Commit 8098eeb693c4 ("drbd: replace genl_magic with explicit netlink serialization") from May 6, 2026 (linux-next), leads to the following Smatch static checker warning:

	drivers/block/drbd/drbd_nl_gen.c:1859 drbd_cfg_reply_to_skb()
	warn: unsigned 's->info_text_len' is never less than zero.

drivers/block/drbd/drbd_nl_gen.c

    1852 int drbd_cfg_reply_to_skb(struct sk_buff *skb, struct drbd_cfg_reply *s)
    1853 {
    1854         struct nlattr *tla = nla_nest_start(skb, DRBD_NLA_CFG_REPLY);
    1855 
    1856         if (!tla)
    1857                 goto nla_put_failure;
    1858 
--> 1859         if (nla_put(skb, DRBD_A_DRBD_CFG_REPLY_INFO_TEXT, min_t(int, 0,
    1860                         s->info_text_len + (s->info_text_len < 0)), s->info_text))
                                                     ^^^^^^^^^^^^^^^^^^^^

This is a u32 so it can't be negative.

    1861                 goto nla_put_failure;
    1862 
    1863         nla_nest_end(skb, tla);
    1864         return 0;
    1865 
    1866 nla_put_failure:
    1867         if (tla)
    1868                 nla_nest_cancel(skb, tla);
    1869         return -EMSGSIZE;
    1870 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter