Date: 14 Dec 2003 03:37:09 -0000 From: Andreas Hauser <andy-freebsd@splashground.de> To: Dag-Erling Smorgrav <des@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libpam/modules/pam_ksu pam_ksu.c Message-ID: <20031214033709.32386.qmail@paladin.fortunaty.net> In-Reply-To: <200312111551.hBBFp4jE018886@repoman.freebsd.org> References: <200312111551.hBBFp4jE018886@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
des wrote @ Thu, 11 Dec 2003 07:51:04 -0800 (PST): > des 2003/12/11 07:51:04 PST > > FreeBSD src repository > > Modified files: > lib/libpam/modules/pam_ksu pam_ksu.c > Log: > Fix a strict aliasing issue. Same issue fixed for libexec/ypxfr/ypxfr_misc.c and usr.sbin/kldxref/kldxref.c Dunno if the kldxref one is possible without an union. With those and the pam ones my system (5.2-BETA) compiles again with -Os. Thank you, Andy Index: libexec/ypxfr/ypxfr_misc.c =================================================================== RCS file: /home/ncvs/src/libexec/ypxfr/ypxfr_misc.c,v retrieving revision 1.15 diff -u -p -r1.15 ypxfr_misc.c --- libexec/ypxfr/ypxfr_misc.c 4 May 2003 00:59:13 -0000 1.15 +++ libexec/ypxfr/ypxfr_misc.c 14 Dec 2003 02:56:58 -0000 @@ -194,9 +194,9 @@ unsigned long ypxfr_get_order(char *domain, char *map, char *source, const int yplib) { if (yplib) { - unsigned long order; + int order; int res; - if ((res = yp_order(domain, map, (int *)&order))) { + if ((res = yp_order(domain, map, &order))) { switch (res) { case YPERR_DOMAIN: yp_errno = YPXFR_NODOM; @@ -211,7 +211,7 @@ ypxfr_get_order(char *domain, char *map, } return(0); } else - return(order); + return((unsigned long)order); } else { CLIENT *clnt; ypresp_order *resp; Index: usr.sbin/kldxref/kldxref.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/kldxref/kldxref.c,v retrieving revision 1.5 diff -u -p -r1.5 kldxref.c --- usr.sbin/kldxref/kldxref.c 21 Jan 2003 03:51:53 -0000 1.5 +++ usr.sbin/kldxref/kldxref.c 14 Dec 2003 01:20:51 -0000 @@ -153,8 +153,16 @@ static int parse_entry(struct mod_metadata *md, const char *cval, struct elf_file *ef, const char *kldname) { - struct mod_depend mdp; - struct mod_version mdv; + union + { + struct mod_depend strct; + void **ptr; + } mdp; + union + { + struct mod_version strct; + void **ptr; + } mdv; Elf_Off data = (Elf_Off)md->md_data; int error = 0; @@ -163,19 +171,19 @@ parse_entry(struct mod_metadata *md, con case MDT_DEPEND: if (!dflag) break; - check(ef_seg_read(ef, data, sizeof(mdp), (void**)&mdp)); + check(ef_seg_read(ef, data, sizeof(mdp.strct), &(mdp.ptr))); printf(" depends on %s.%d (%d,%d)\n", cval, - mdp.md_ver_preferred, mdp.md_ver_minimum, mdp.md_ver_maximum); + mdp.strct.md_ver_preferred, mdp.strct.md_ver_minimum, mdp.strct.md_ver_maximum); break; case MDT_VERSION: - check(ef_seg_read(ef, data, sizeof(mdv), (void**)&mdv)); + check(ef_seg_read(ef, data, sizeof(mdv.strct), &(mdv.ptr))); record_int(MDT_VERSION); record_string(cval); - record_int(mdv.mv_version); + record_int(mdv.strct.mv_version); record_string(kldname); if (!dflag) break; - printf(" interface %s.%d\n", cval, mdv.mv_version); + printf(" interface %s.%d\n", cval, mdv.strct.mv_version); break; case MDT_MODULE: record_int(MDT_MODULE); @@ -200,7 +208,7 @@ read_kld(char *filename, char *kldname) struct elf_file ef; /* struct kld_info *kip; struct mod_info *mip;*/ - void **p, **orgp; + void *p, **orgp; int error, nmlen; long start, finish, entries; Elf_Sym *sym; @@ -229,11 +237,10 @@ read_kld(char *filename, char *kldname) check(ef_lookup_symbol(&ef, "__stop_set_" MDT_SETNAME, &sym)); finish = sym->st_value; entries = (finish - start) / sizeof(void *); - check(ef_seg_read_entry_rel(&ef, start, sizeof(*p) * entries, - (void**)&p)); + check(ef_seg_read_entry_rel(&ef, start, sizeof(*p) * entries, &p)); orgp = p; while(entries--) { - check(ef_seg_read_rel(&ef, (Elf_Off)*p, sizeof(md), &md)); + check(ef_seg_read_rel(&ef, *(Elf_Off *)p, sizeof(md), &md)); p++; check(ef_seg_read(&ef, (Elf_Off)md.md_cval, sizeof(cval), cval)); cval[MAXMODNAME] = '\0';
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031214033709.32386.qmail>