Hello Jayamohan,
I had a question about 3ec7827134a9: "[SCSI] be2iscsi: WRB
Initialization and Failure code path change" from Apr 3, 2012.
drivers/scsi/be2iscsi/be_main.c
2683 for (index = 0; index < phba->params.cxns_per_ctrl * 2; index
+= 2) {
^^^^^^^^^^
We are allocating every other element in the array. Why?
2684 pwrb_context = &phwi_ctrlr->wrb_context[index];
2685 pwrb_context->pwrb_handle_base =
2686 kzalloc(sizeof(struct wrb_handle *) *
2687 phba->params.wrbs_per_cxn,
GFP_KERNEL);
2688 if (!pwrb_context->pwrb_handle_base) {
2689 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2690 "BM_%d : Mem Alloc Failed. Failing
to load\n");
2691 goto init_wrb_hndl_failed;
2692 }
[snip]
2746 init_wrb_hndl_failed:
2747 for (j = index; j > 0; j--) {
^^^^^^^^^^^^^^^^^^^^^
Here we are freeing every element in the array except ->wrb_context[0].
Some of the elements were not allocated, and doesn't skipping zero lead
to a memory leak?
2748 pwrb_context = &phwi_ctrlr->wrb_context[j];
2749 kfree(pwrb_context->pwrb_handle_base);
2750 kfree(pwrb_context->pwrb_handle_basestd);
2751 }
2752 return -ENOMEM;
2753 }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html