You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
hpsa: fix memory leak in hpsa_hba_mode_enabled
And while we're at it fix a magic number Signed-off-by: Joe Handzik <joseph.t.handzik@hp.com> Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
committed by
Christoph Hellwig
parent
3b7a45e5ba
commit
6e8e8088aa
+6
-1
@@ -2977,6 +2977,7 @@ u8 *figure_lunaddrbytes(struct ctlr_info *h, int raid_ctlr_position, int i,
|
|||||||
static int hpsa_hba_mode_enabled(struct ctlr_info *h)
|
static int hpsa_hba_mode_enabled(struct ctlr_info *h)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
int hba_mode_enabled;
|
||||||
struct bmic_controller_parameters *ctlr_params;
|
struct bmic_controller_parameters *ctlr_params;
|
||||||
ctlr_params = kzalloc(sizeof(struct bmic_controller_parameters),
|
ctlr_params = kzalloc(sizeof(struct bmic_controller_parameters),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
@@ -2989,7 +2990,11 @@ static int hpsa_hba_mode_enabled(struct ctlr_info *h)
|
|||||||
kfree(ctlr_params);
|
kfree(ctlr_params);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return ctlr_params->nvram_flags & (1 << 3) ? 1 : 0;
|
|
||||||
|
hba_mode_enabled =
|
||||||
|
((ctlr_params->nvram_flags & HBA_MODE_ENABLED_FLAG) != 0);
|
||||||
|
kfree(ctlr_params);
|
||||||
|
return hba_mode_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
|
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ struct bmic_controller_parameters {
|
|||||||
u8 automatic_drive_slamming;
|
u8 automatic_drive_slamming;
|
||||||
u8 reserved1;
|
u8 reserved1;
|
||||||
u8 nvram_flags;
|
u8 nvram_flags;
|
||||||
|
#define HBA_MODE_ENABLED_FLAG (1 << 3)
|
||||||
u8 cache_nvram_flags;
|
u8 cache_nvram_flags;
|
||||||
u8 drive_config_flags;
|
u8 drive_config_flags;
|
||||||
u16 reserved2;
|
u16 reserved2;
|
||||||
|
|||||||
Reference in New Issue
Block a user