--- acpi_ids.c.old 2009-04-29 16:37:13.000000000 +0200 +++ acpi_ids.c 2009-05-03 16:13:19.000000000 +0200 @@ -92,12 +92,13 @@ */ struct rtattr *tb[CTRL_ATTR_MAX + 1]; /* pointer to the generic netlink header in the incoming message */ - struct genlmsghdr *ghdr = NLMSG_DATA(n); + struct genlmsghdr ghdr; /* length of the attribute and payload */ int len = n->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN); /* Pointer to the attribute portion of the message */ struct rtattr *attrs; + memcpy(&ghdr, NLMSG_DATA(n), sizeof(ghdr)); if (len < 0) { fprintf(stderr, "%s: netlink CTRL_CMD_GETFAMILY response, " "wrong controller message len: %d\n", progname, len); @@ -111,18 +112,18 @@ return 0; } - if (ghdr->cmd != CTRL_CMD_GETFAMILY && - ghdr->cmd != CTRL_CMD_DELFAMILY && - ghdr->cmd != CTRL_CMD_NEWFAMILY && - ghdr->cmd != CTRL_CMD_NEWMCAST_GRP && - ghdr->cmd != CTRL_CMD_DELMCAST_GRP) { + if (ghdr.cmd != CTRL_CMD_GETFAMILY && + ghdr.cmd != CTRL_CMD_DELFAMILY && + ghdr.cmd != CTRL_CMD_NEWFAMILY && + ghdr.cmd != CTRL_CMD_NEWMCAST_GRP && + ghdr.cmd != CTRL_CMD_DELMCAST_GRP) { fprintf(stderr, "%s: unknown netlink controller command %d\n", - progname, ghdr->cmd); + progname, ghdr.cmd); return 0; } /* set attrs to point to the attribute */ - attrs = (struct rtattr *)((char *)ghdr + GENL_HDRLEN); + attrs = (struct rtattr *)((char *)NLMSG_DATA(n) + GENL_HDRLEN); /* Read the table from the message into "tb". This actually just */ /* places pointers into the message into tb[]. */ parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len); @@ -168,7 +169,7 @@ /* pointer to the nlmsghdr in req */ struct nlmsghdr *nlh; /* pointer to the generic netlink header in req */ - struct genlmsghdr *ghdr; + struct genlmsghdr ghdr; /* return value */ int ret = -1; @@ -183,9 +184,9 @@ nlh->nlmsg_type = GENL_ID_CTRL; /* set up ghdr to point to the generic netlink header */ - ghdr = NLMSG_DATA(&req.n); /* set the command we want to run: "GETFAMILY" */ - ghdr->cmd = CTRL_CMD_GETFAMILY; + ghdr.cmd = CTRL_CMD_GETFAMILY; + memcpy(NLMSG_DATA(&req.n), &ghdr, sizeof(ghdr)); /* the message payload is the family name */ addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME,