On Fri, 3 May 2013 11:17:08 -0500 Serge Hallyn <serge.hal...@ubuntu.com> wrote:
> can that be correct? That changes the value of the > pointer. NLMSG_DATA adds aligned sizeof(struct nlmsghdr). The current code is relying on the fact that our genlmsg looks like this: struct genlmsg { struct nlmsghdr nlmsghdr; struct genlmsghdr genlmsghdr; }; so NLMSG_DATA(&request->nlmsghdr) == genlmsghdr (I think sizeof struct nlmsghdr will make genlmsghdr be aligned anyway?). Right now lxc doesn't use this code so I cannot test it in lxc, but let me write a test program that dumps the pointers using the old way and the new way. We do have a 2*PAGE_SIZE buffer these point to so I'm sure its not overflowing, so maybe we do just want to ignore coverity. > I suspect lxc is doing the right thing in practice, but could > do some sort of casting somewhere to tell coverity to lighten > up. But I haven't yet figured out what that is. > > Quoting Dwight Engen (dwight.en...@oracle.com): > > Signed-off-by: Dwight Engen <dwight.en...@oracle.com> > > --- > > src/lxc/genl.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/src/lxc/genl.c b/src/lxc/genl.c > > index 873b084..8fcb6b7 100644 > > --- a/src/lxc/genl.c > > +++ b/src/lxc/genl.c > > @@ -55,7 +55,7 @@ static int genetlink_resolve_family(const char > > *family) request->nlmsghdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; > > request->nlmsghdr.nlmsg_type = GENL_ID_CTRL; > > > > - genlmsghdr = NLMSG_DATA(&request->nlmsghdr); > > + genlmsghdr = &request->genlmsghdr; > > genlmsghdr->cmd = CTRL_CMD_GETFAMILY; > > > > ret = netlink_open(&handler, NETLINK_GENERIC); > > @@ -72,7 +72,7 @@ static int genetlink_resolve_family(const char > > *family) if (ret < 0) > > goto out_close; > > > > - genlmsghdr = NLMSG_DATA(&reply->nlmsghdr); > > + genlmsghdr = &reply->genlmsghdr; > > len = reply->nlmsghdr.nlmsg_len; > > > > ret = -ENOMSG; > > -- > > 1.8.1.4 > > > > > > ------------------------------------------------------------------------------ > > Get 100% visibility into Java/.NET code with AppDynamics Lite > > It's a free troubleshooting tool designed for production > > Get down to code-level detail for bottlenecks, with <2% overhead. > > Download for free and get started troubleshooting in minutes. > > http://p.sf.net/sfu/appdyn_d2d_ap2 > > _______________________________________________ > > Lxc-devel mailing list > > Lxc-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/lxc-devel ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite It's a free troubleshooting tool designed for production Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap2 _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel