Print this page
10138 smatch fixes for usr/src/cmd/sgs


 816                 reloc_symtab = p_symtab;
 817         } else if (head_scns->p_shdr.sh_type  == SHT_DYNSYM) {
 818                 reloc_symtab = p_dynsym;
 819         } else {
 820                 (void) fprintf(stderr,
 821 "%s: %s: could not get symbol table\n", prog_name, filename);
 822                 return;
 823         }
 824 
 825         sym_data = NULL;
 826         sym_size = 0;
 827         reloc_size = 0;
 828 
 829         if ((sym_data = elf_getdata(reloc_symtab->p_sd, NULL)) == NULL) {
 830                 (void) fprintf(stderr,
 831                 "%s: %s: no symbol table data\n", prog_name, filename);
 832                 return;
 833         }
 834         sym_size = sym_data->d_size;
 835 
 836         if (p_scns == NULL) {
 837                 (void) fprintf(stderr,
 838                 "%s: %s: no section table data\n", prog_name, filename);
 839                 return;
 840         }
 841 
 842         if (p_scns->p_shdr.sh_type == SHT_RELA) {
 843                 if (!n_flag && r_flag)
 844                         (void) printf("\n%s:\n", p_scns->scn_name);
 845                 if (!p_flag && (!n_flag && r_flag))
 846                         (void) printf("%-*s%-*s%-*s%s\n\n",
 847                             12 + adj, "Offset", 22, "Symndx",
 848                             18, "Type", "Addend");
 849                 if ((rel_data = elf_getdata(p_scns->p_sd, NULL)) == NULL) {
 850                         (void) fprintf(stderr,
 851 "%s: %s: no relocation information\n", prog_name, filename);
 852                         return;
 853                 }
 854                 reloc_size = rel_data->d_size;
 855 
 856                 if (n_flag) {
 857                         rn_flag = 1;
 858                         print_rela(elf_file, p_scns, rel_data, sym_data, p_ehdr,
 859                             reloc_size, sym_size, filename, reloc_symtab);
 860                 }
 861                 if (d_flag) {




 816                 reloc_symtab = p_symtab;
 817         } else if (head_scns->p_shdr.sh_type  == SHT_DYNSYM) {
 818                 reloc_symtab = p_dynsym;
 819         } else {
 820                 (void) fprintf(stderr,
 821 "%s: %s: could not get symbol table\n", prog_name, filename);
 822                 return;
 823         }
 824 
 825         sym_data = NULL;
 826         sym_size = 0;
 827         reloc_size = 0;
 828 
 829         if ((sym_data = elf_getdata(reloc_symtab->p_sd, NULL)) == NULL) {
 830                 (void) fprintf(stderr,
 831                 "%s: %s: no symbol table data\n", prog_name, filename);
 832                 return;
 833         }
 834         sym_size = sym_data->d_size;
 835 






 836         if (p_scns->p_shdr.sh_type == SHT_RELA) {
 837                 if (!n_flag && r_flag)
 838                         (void) printf("\n%s:\n", p_scns->scn_name);
 839                 if (!p_flag && (!n_flag && r_flag))
 840                         (void) printf("%-*s%-*s%-*s%s\n\n",
 841                             12 + adj, "Offset", 22, "Symndx",
 842                             18, "Type", "Addend");
 843                 if ((rel_data = elf_getdata(p_scns->p_sd, NULL)) == NULL) {
 844                         (void) fprintf(stderr,
 845 "%s: %s: no relocation information\n", prog_name, filename);
 846                         return;
 847                 }
 848                 reloc_size = rel_data->d_size;
 849 
 850                 if (n_flag) {
 851                         rn_flag = 1;
 852                         print_rela(elf_file, p_scns, rel_data, sym_data, p_ehdr,
 853                             reloc_size, sym_size, filename, reloc_symtab);
 854                 }
 855                 if (d_flag) {