[bug report] mqprio: Introduce new hardware offload mode and shaper in mqprio

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

 



Hello Amritha Nambiar,

This is a semi-automatic email about new static checker warnings.

The patch 4e8b86c06269: "mqprio: Introduce new hardware offload mode 
and shaper in mqprio" from Sep 7, 2017, leads to the following Smatch 
complaint:

net/sched/sch_mqprio.c:156 mqprio_init()
	 warn: variable dereferenced before check 'opt' (see line 145)

net/sched/sch_mqprio.c
   144		int rem;
   145		int len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt));
                          ^^^^^^^^^^^
Patch adds new dereference.

   146	
   147		BUILD_BUG_ON(TC_MAX_QUEUE != TC_QOPT_MAX_QUEUE);
   148		BUILD_BUG_ON(TC_BITMASK != TC_QOPT_BITMASK);
   149	
   150		if (sch->parent != TC_H_ROOT)
   151			return -EOPNOTSUPP;
   152	
   153		if (!netif_is_multiqueue(dev))
   154			return -EOPNOTSUPP;
   155	
   156		if (!opt || nla_len(opt) < sizeof(*qopt))
                    ^^^^
The old code checked for NULL.  You also might want to consider changing
the "|| nla_len(opt) < sizeof(*qopt)" to:
    "|| nla_len(opt) < NLA_ALIGN(sizeof(*qopt))", just for consistency.

   157			return -EINVAL;
   158	

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux