Skip to contentSkip to conversation

component: add support for component match array

DISCUSSION Dan Carpenter 1 participant 1 message Jul 7, 2014 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Russell King,

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

The patch 6955b58254c2: "component: add support for component match array" from Apr 19, 2014, leads to the following Smatch complaint:

drivers/base/component.c:297 component_master_add_with_match()
error: we previously assumed 'match' could be null (see line 293)

drivers/base/component.c
292
293 if (ops->add_components && match)

                                           ^^^^^

Patch adds new check.

294 return -EINVAL;
295
296 /* Reallocate the match array for its true size */

   297		match = component_match_realloc(dev, match, match->num);
                                                            ^^^^^^^^^^

Patch adds unchecked dereference.

   298		if (IS_ERR(match))
   299			return PTR_ERR(match);

regards,
dan carpenter