Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP


 635 static int
 636 find_matching_proc(smbios_hdl_t *shp, uint_t strand_apicid,
 637     uint16_t bb_id, uint16_t proc_hdl, int is_proc)
 638 {
 639         int n;
 640         const smb_struct_t *sp;
 641         smbios_bboard_t bb;
 642         uint_t cont_count, cont_len;
 643         uint16_t cont_id;
 644         id_t *cont_hdl = NULL;
 645         int rc;
 646 
 647 
 648         (void) smbios_info_bboard(shp, bb_id, &bb);
 649         cont_count = (uint_t)bb.smbb_contn;
 650         if (cont_count == 0)
 651                 return (0);
 652 
 653         cont_len = sizeof (id_t);
 654         cont_hdl = kmem_zalloc(cont_count * cont_len, KM_SLEEP);
 655         if (cont_hdl == NULL)
 656                 return (0);
 657 
 658         rc = smbios_info_contains(shp, bb_id, cont_count, cont_hdl);
 659         if (rc > SMB_CONT_MAX) {
 660                 kmem_free(cont_hdl, cont_count * cont_len);
 661                 return (0);
 662         }
 663         cont_count = MIN(rc, cont_count);
 664 
 665         for (n = 0; n < cont_count; n++) {
 666                 cont_id = (uint16_t)cont_hdl[n];
 667                 sp = smb_lookup_id(shp, cont_id);
 668                 if (sp->smbst_hdr->smbh_type == SMB_TYPE_PROCESSOR) {
 669                         if (is_proc) {
 670                                 if (find_matching_apic(shp, cont_id,
 671                                     strand_apicid)) {
 672                                         kmem_free(cont_hdl,
 673                                             cont_count * cont_len);
 674                                         return (1);
 675                                 }
 676                         } else {




 635 static int
 636 find_matching_proc(smbios_hdl_t *shp, uint_t strand_apicid,
 637     uint16_t bb_id, uint16_t proc_hdl, int is_proc)
 638 {
 639         int n;
 640         const smb_struct_t *sp;
 641         smbios_bboard_t bb;
 642         uint_t cont_count, cont_len;
 643         uint16_t cont_id;
 644         id_t *cont_hdl = NULL;
 645         int rc;
 646 
 647 
 648         (void) smbios_info_bboard(shp, bb_id, &bb);
 649         cont_count = (uint_t)bb.smbb_contn;
 650         if (cont_count == 0)
 651                 return (0);
 652 
 653         cont_len = sizeof (id_t);
 654         cont_hdl = kmem_zalloc(cont_count * cont_len, KM_SLEEP);


 655 
 656         rc = smbios_info_contains(shp, bb_id, cont_count, cont_hdl);
 657         if (rc > SMB_CONT_MAX) {
 658                 kmem_free(cont_hdl, cont_count * cont_len);
 659                 return (0);
 660         }
 661         cont_count = MIN(rc, cont_count);
 662 
 663         for (n = 0; n < cont_count; n++) {
 664                 cont_id = (uint16_t)cont_hdl[n];
 665                 sp = smb_lookup_id(shp, cont_id);
 666                 if (sp->smbst_hdr->smbh_type == SMB_TYPE_PROCESSOR) {
 667                         if (is_proc) {
 668                                 if (find_matching_apic(shp, cont_id,
 669                                     strand_apicid)) {
 670                                         kmem_free(cont_hdl,
 671                                             cont_count * cont_len);
 672                                         return (1);
 673                                 }
 674                         } else {