Project

General

Profile

Bug #5589 ยป 0001-5589-improper-use-of-NULL-in-tools-ctf.patch

Richard PALO, 2015-02-04 08:33 AM

View differences:

usr/src/tools/ctf/cvt/ctf.c
1216 1216
	    (rc = inflate(&zstr, Z_NO_FLUSH)) != Z_STREAM_END ||
1217 1217
	    (rc = inflateEnd(&zstr)) != Z_OK) {
1218 1218
		warning("CTF decompress zlib error %s\n", zError(rc));
1219
		return (NULL);
1219
		return (0);
1220 1220
	}
1221 1221

  
1222 1222
	debug(3, "reflated %lu bytes to %lu, pointer at %d\n",
usr/src/tools/ctf/cvt/dwarf.c
1714 1714
	{ DW_TAG_variable,		DW_F_NOTDP,	die_variable_create },
1715 1715
	{ DW_TAG_volatile_type,		0,		die_volatile_create },
1716 1716
	{ DW_TAG_restrict_type,		0,		die_restrict_create },
1717
	{ 0, NULL }
1717
	{ 0,  0, NULL}
1718 1718
};
1719 1719

  
1720 1720
static const die_creator_t *
usr/src/tools/ctf/cvt/output.c
466 466
	int pad;
467 467
	int i;
468 468

  
469
	if (gelf_newehdr(dst, gelf_getclass(src)) == NULL)
469
	if (gelf_newehdr(dst, gelf_getclass(src)) == 0)
470 470
		elfterminate(dstname, "Cannot copy ehdr to temp file");
471 471
	gelf_getehdr(src, &sehdr);
472 472
	memcpy(&dehdr, &sehdr, sizeof (GElf_Ehdr));
......
482 482
	 */
483 483
	if (sehdr.e_phnum != 0) {
484 484
		(void) elf_flagelf(dst, ELF_C_SET, ELF_F_LAYOUT);
485
		if (gelf_newphdr(dst, sehdr.e_phnum) == NULL)
485
		if (gelf_newphdr(dst, sehdr.e_phnum) == 0)
486 486
			elfterminate(dstname, "Cannot make phdrs in temp file");
487 487

  
488 488
		for (i = 0; i < sehdr.e_phnum; i++) {
......
616 616
			}
617 617
		}
618 618

  
619
		if (gelf_update_shdr(dscn, &shdr) == NULL)
619
		if (gelf_update_shdr(dscn, &shdr) == 0)
620 620
			elfterminate(dstname, "Cannot update sect %s", sname);
621 621

  
622 622
		new_offset = (off_t)shdr.sh_offset;
usr/src/tools/ctf/stabs/common/genassym.c
272 272
	char *c;
273 273
	int rc;
274 274

  
275
	if ((c = strchr(md->gmcb_memname, '.')) != NULL)
276
		*c++ = NULL;
275
	if ((c = strchr(md->gmcb_memname, '.')) != 0)
276
		*c++ = '\0';
277 277
	md->gmcb_submem = c;
278 278

  
279 279
	if ((rc = ctf_member_iter(ctf, curtype, ga_member_cb, md)) == 0) {
    (1-1/1)