Message ID | SY8P282MB45806566552C64BF7F6FF689CD072@SY8P282MB4580.AUSP282.PROD.OUTLOOK.COM |
---|---|
State | Accepted |
Commit | 120140f891a2b9502fba54ae1f7031e7c4f68f1e |
Delegated to: | Ilya Maximets |
Headers | show |
Series | [ovs-dev,v2] ofproto: Fix Coverity false positive. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
On 4/9/24 16:45, miterv@outlook.com wrote: > From: Lin Huang <linhuang@ruijie.com.cn> > > Coverity reports a false positive below: > Ofproto_class_find__() may return NULL, and dereference it to cause segfault. > > This patch is made just to avoid false-positive Coverity report. > > Tested-by: Zhang YuHuang <zhangyuhuang@ruijie.com.cn> > Signed-off-by: Lin Huang <linhuang@ruijie.com.cn> > --- > ofproto/ofproto.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c > index 122a06f30..21c6a1d82 100644 > --- a/ofproto/ofproto.c > +++ b/ofproto/ofproto.c > @@ -800,7 +800,7 @@ ofproto_type_set_config(const char *datapath_type, const struct smap *cfg) > datapath_type = ofproto_normalize_type(datapath_type); > class = ofproto_class_find__(datapath_type); > > - if (class->type_set_config) { > + if (class && class->type_set_config) { > class->type_set_config(datapath_type, cfg); > } > } Thanks for the update! Applied. Best regards, Ilya Maximets.
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 122a06f30..21c6a1d82 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -800,7 +800,7 @@ ofproto_type_set_config(const char *datapath_type, const struct smap *cfg) datapath_type = ofproto_normalize_type(datapath_type); class = ofproto_class_find__(datapath_type); - if (class->type_set_config) { + if (class && class->type_set_config) { class->type_set_config(datapath_type, cfg); } }