From 4ba84af54d7e87f645088b6bb6f9baac08e77373 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Tue, 30 Mar 2021 00:01:06 +0300 Subject: 13680 libfruraw: 'hash_obj' may be used uninitialized Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/lib/libfru/libfruraw/raw_access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/src/lib/libfru/libfruraw/raw_access.c b/usr/src/lib/libfru/libfruraw/raw_access.c index 7c1d2077e1..3ffca614da 100644 --- a/usr/src/lib/libfru/libfruraw/raw_access.c +++ b/usr/src/lib/libfru/libfruraw/raw_access.c @@ -205,7 +205,7 @@ create_packet_hash_object(void) static hash_obj_t * get_container_hash_object(int object_type, handle_t handle) { - hash_obj_t *hash_obj; + hash_obj_t *hash_obj = NULL; switch (object_type) { case CONTAINER_TYPE: -- cgit v1.2.3 From dd699a3e07422d6135575d35b14927cd260ef32e Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Wed, 17 Mar 2021 12:11:07 +0200 Subject: 13682 libc: '_getcontext' specifies less restrictive attribute than its target Reviewed by: Robert Mustacchi Approved by: Gordon Ross --- usr/src/lib/libc/inc/libc.h | 5 +++++ usr/src/lib/libc/sparc/gen/getctxt.c | 9 ++++----- usr/src/lib/libc/sparcv9/gen/getctxt.c | 9 ++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/usr/src/lib/libc/inc/libc.h b/usr/src/lib/libc/inc/libc.h index 90a2859b33..98872ac161 100644 --- a/usr/src/lib/libc/inc/libc.h +++ b/usr/src/lib/libc/inc/libc.h @@ -221,6 +221,11 @@ extern int _so_getsockopt(int, int, int, char *, int *); */ extern int lsign(dl_t); +/* + * defined in getctxt.c + */ +extern int _getcontext(ucontext_t *) __RETURNS_TWICE; + /* * defined in ucontext.s */ diff --git a/usr/src/lib/libc/sparc/gen/getctxt.c b/usr/src/lib/libc/sparc/gen/getctxt.c index 3213955108..317a3f92ec 100644 --- a/usr/src/lib/libc/sparc/gen/getctxt.c +++ b/usr/src/lib/libc/sparc/gen/getctxt.c @@ -25,16 +25,15 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#pragma weak _getcontext = getcontext +/* All Rights Reserved */ #include "lint.h" #include "thr_uberdata.h" #include #include +#include "libc.h" + +#pragma weak _getcontext = getcontext int getcontext(ucontext_t *ucp) diff --git a/usr/src/lib/libc/sparcv9/gen/getctxt.c b/usr/src/lib/libc/sparcv9/gen/getctxt.c index 3213955108..317a3f92ec 100644 --- a/usr/src/lib/libc/sparcv9/gen/getctxt.c +++ b/usr/src/lib/libc/sparcv9/gen/getctxt.c @@ -25,16 +25,15 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#pragma weak _getcontext = getcontext +/* All Rights Reserved */ #include "lint.h" #include "thr_uberdata.h" #include #include +#include "libc.h" + +#pragma weak _getcontext = getcontext int getcontext(ucontext_t *ucp) -- cgit v1.2.3 From 1d9fea2a5ece48bb3a7c454829f0c8a68b9fe5e1 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Wed, 17 Mar 2021 11:59:27 +0200 Subject: 13683 libc: uninitialized variables Reviewed by: C Fraire Approved by: Dan McDonald --- usr/src/lib/libc/sparc/fp/_D_cplx_mul.c | 4 +--- usr/src/lib/libc/sparc/fp/_F_cplx_mul.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_div.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c | 4 +--- usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c | 4 +--- 10 files changed, 10 insertions(+), 30 deletions(-) diff --git a/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c b/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c index 6e32418f72..bfb92e1789 100644 --- a/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c +++ b/usr/src/lib/libc/sparc/fp/_D_cplx_mul.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * _D_cplx_mul(z, w) returns z * w with infinities handled according * to C99. @@ -82,7 +80,7 @@ testinf(double x) double _Complex _D_cplx_mul(double _Complex z, double _Complex w) { - double _Complex v; + double _Complex v = 0; double a, b, c, d, x, y; int recalc, i, j; diff --git a/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c b/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c index f4073e9327..026a60c7a4 100644 --- a/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c +++ b/usr/src/lib/libc/sparc/fp/_F_cplx_mul.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * _F_cplx_mul(z, w) returns z * w with infinities handled according * to C99. @@ -79,7 +77,7 @@ testinff(float x) float _Complex _F_cplx_mul(float _Complex z, float _Complex w) { - float _Complex v; + float _Complex v = 0; float a, b, c, d; double x, y; int recalc, i, j; diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c index b529c5eecf..8740c42f54 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_div.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_div(v, z, w) sets *v = *z / *w with infin- * ities handling according to C99. @@ -85,7 +83,7 @@ testinfl(long double x) long double _Complex _Q_cplx_div(const long double _Complex *z, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_div(long double _Complex *v, const long double _Complex *z, diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c index 2d9c18ba02..fa2b595406 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_ix.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_div_ix(v, b, w) sets *v = (I * *b / *w) with * infinities handling according to C99. @@ -80,7 +78,7 @@ testinfl(long double x) long double _Complex _Q_cplx_div_ix(const long double *pb, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_div_ix(long double _Complex *v, const long double *pb, diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c index 80f050bd94..a500db400f 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_div_rx.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_div_rx(v, a, w) sets *v = *a / *w with in- * finities handling according to C99. @@ -80,7 +78,7 @@ testinfl(long double x) long double _Complex _Q_cplx_div_rx(const long double *pa, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_div_rx(long double _Complex *v, const long double *pa, diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c index 92473041e3..120b94f38b 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_lr_div(v, z, w) sets *v = *z / *w computed * by the textbook formula without regard to exceptions or special @@ -45,7 +43,7 @@ long double _Complex _Q_cplx_lr_div(const long double _Complex *z, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_lr_div(long double _Complex *v, const long double _Complex *z, diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c index ca968d809a..916d239159 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_ix.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_lr_div_ix(v, b, w) sets *v = (I * *b / *w) * compute by the textbook formula without regard to exceptions or @@ -45,7 +43,7 @@ long double _Complex _Q_cplx_lr_div_ix(const long double *pb, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_lr_div_ix(long double _Complex *v, const long double *pb, diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c index b6b91ddf48..8159e10ab0 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_div_rx.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_lr_div_rx(v, a, w) sets *v = *a / *w computed * by the textbook formula without regard to exceptions or special @@ -45,7 +43,7 @@ long double _Complex _Q_cplx_lr_div_rx(const long double *pa, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_lr_div_rx(long double _Complex *v, const long double *pa, diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c index f2be5888df..b52ead1ba2 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_lr_mul.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_lr_mul(v, z, w) sets *v = *z * *w computed by * the textbook formula without regard to exceptions or special cases. @@ -44,7 +42,7 @@ long double _Complex _Q_cplx_lr_mul(const long double _Complex *z, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_lr_mul(long double _Complex *v, const long double _Complex *z, diff --git a/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c b/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c index 9e4d41b2f7..6afbbe6a19 100644 --- a/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c +++ b/usr/src/lib/libc/sparc/fp/_Q_cplx_mul.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * On SPARC V8, _Q_cplx_mul(v, z, w) sets *v = *z * *w with infinities * handled according to C99. @@ -86,7 +84,7 @@ testinfl(long double x) long double _Complex _Q_cplx_mul(const long double _Complex *z, const long double _Complex *w) { - long double _Complex v; + long double _Complex v = 0; #else void _Q_cplx_mul(long double _Complex *v, const long double _Complex *z, -- cgit v1.2.3 From 5eb35ba24893e16e4e108a951856b8d948493f28 Mon Sep 17 00:00:00 2001 From: Richard Lowe Date: Sun, 21 Mar 2021 17:54:36 -0500 Subject: 13675 use NATIVE_LIBS don't pass -zassert-deflib manually Reviewed by: Dan McDonald Reviewed by: Toomas Soome Approved by: Robert Mustacchi --- usr/src/cmd/sgs/elfdump/Makefile.com | 2 +- usr/src/cmd/sgs/tools/Makefile.com | 2 +- usr/src/lib/libc/amd64/Makefile | 4 +++- usr/src/lib/libc/i386/Makefile.com | 4 +++- usr/src/lib/libc/sparc/Makefile.com | 4 +++- usr/src/lib/libc/sparcv9/Makefile.com | 4 +++- usr/src/tools/Makefile.tools | 3 ++- 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/usr/src/cmd/sgs/elfdump/Makefile.com b/usr/src/cmd/sgs/elfdump/Makefile.com index 59a1e75556..085591a246 100644 --- a/usr/src/cmd/sgs/elfdump/Makefile.com +++ b/usr/src/cmd/sgs/elfdump/Makefile.com @@ -57,7 +57,7 @@ LDFLAGS += $(VERSREF) $(MAPOPT) $(LLDFLAGS) LDLIBS += $(ELFLIBDIR) -lelf $(LDDBGLIBDIR) -llddbg \ $(CONVLIBDIR) -lconv -NATIVE_LDFLAGS = $(LDASSERTS) $(BDIRECT) $(ZASSERTDEFLIB)=libc.so +NATIVE_LDFLAGS = $(LDASSERTS) $(BDIRECT) CERRWARN += $(CNOWARN_UNINIT) diff --git a/usr/src/cmd/sgs/tools/Makefile.com b/usr/src/cmd/sgs/tools/Makefile.com index 634fec820a..9d1c34949c 100644 --- a/usr/src/cmd/sgs/tools/Makefile.com +++ b/usr/src/cmd/sgs/tools/Makefile.com @@ -42,7 +42,7 @@ include $(SRC)/cmd/sgs/Makefile.com OBJECTS= piglatin.o NATIVECC_CFLAGS = -O -NATIVE_LDFLAGS = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT) +NATIVE_LDFLAGS = $(LDASSERTS) $(BDIRECT) NATIVE= $(OBJECTS:%.o=%) SRCS= $(OBJECTS:%.o=../common/%.c) diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile index 717c549329..0e2d78a484 100644 --- a/usr/src/lib/libc/amd64/Makefile +++ b/usr/src/lib/libc/amd64/Makefile @@ -1241,7 +1241,9 @@ $(ASSYMDEP_OBJS:%=pics/%): assym.h # assym.h build rules GENASSYM_C = genassym.c -LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT) +LDFLAGS.native = $(LDASSERTS) $(BDIRECT) + +genassym := NATIVE_LIBS += libc.so genassym: $(GENASSYM_C) $(NATIVECC) $(NATIVE_CFLAGS) -Iinc -I$(LIBCDIR)/inc $(CPPFLAGS.native) \ diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com index a1c0297112..55bee236c2 100644 --- a/usr/src/lib/libc/i386/Makefile.com +++ b/usr/src/lib/libc/i386/Makefile.com @@ -1319,7 +1319,9 @@ $(ASSYMDEP_OBJS:%=pics/%): assym.h # assym.h build rules GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c -LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT) +LDFLAGS.native = $(LDASSERTS) $(BDIRECT) + +genassym := NATIVE_LIBS += libc.so genassym: $(GENASSYM_C) $(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \ diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com index c699befe9c..9a8ca9ce52 100644 --- a/usr/src/lib/libc/sparc/Makefile.com +++ b/usr/src/lib/libc/sparc/Makefile.com @@ -1380,7 +1380,9 @@ $(ASSYMDEP_OBJS:%=pics/%): assym.h assym.h := CFLAGS += $(CCGDEBUG) GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c -LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT) +LDFLAGS.native = $(LDASSERTS) $(BDIRECT) + +genassym := NATIVE_LIBS += libc.so genassym: $(GENASSYM_C) $(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \ diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com index 120e164f62..1058e950c9 100644 --- a/usr/src/lib/libc/sparcv9/Makefile.com +++ b/usr/src/lib/libc/sparcv9/Makefile.com @@ -1298,7 +1298,9 @@ $(ASSYMDEP_OBJS:%=pics/%): assym.h assym.h := CFLAGS64 += $(CCGDEBUG) GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c -LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT) +LDFLAGS.native = $(LDASSERTS) $(BDIRECT) + +genassym := NATIVE_LIBS += libc.so genassym: $(GENASSYM_C) $(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \ diff --git a/usr/src/tools/Makefile.tools b/usr/src/tools/Makefile.tools index 9fd747751d..315a10b6c6 100644 --- a/usr/src/tools/Makefile.tools +++ b/usr/src/tools/Makefile.tools @@ -55,9 +55,10 @@ ELFSIGN_O= $(TRUE) LDLIBS= LDFLAGS= $(MAPFILE.NES:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%) \ $(MAPFILE.PGA:%=-Wl,-M%) \ - $(ZASSERTDEFLIB)=libc.so \ $(BDIRECT) +NATIVE_LIBS += libc.so + # To work around a bootstrapping problem, we can't rely on cw(1) knowing how # to translate -shared as we may be using an older one to build the current # tools. -- cgit v1.2.3