Re: [PATCH] scsi: lpfc: fix ioremap issues in 'lpfc_sli4_pci_mem_setup'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 03, 2023 at 03:48:21PM +0800, lishuchang@xxxxxxxxxxx wrote:
> @@ -12069,9 +12069,11 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
>  	return 0;
>  
>  out_iounmap_all:
> -	iounmap(phba->sli4_hba.drbl_regs_memmap_p);
> +	if (!phba->sli4_hba.drbl_regs_memmap_p)
> +		iounmap(phba->sli4_hba.drbl_regs_memmap_p);

The test is reversed still.

If you make a mistake, you should write a static checker warning so that
you never make the same mistake again.  ;)  See attached.


>  out_iounmap_ctrl:
> -	iounmap(phba->sli4_hba.ctrl_regs_memmap_p);
> +	if (!phba->sli4_hba.ctrl_regs_memmap_p)

Also reversed.

> +		iounmap(phba->sli4_hba.ctrl_regs_memmap_p);
>  out_iounmap_conf:
>  	iounmap(phba->sli4_hba.conf_regs_memmap_p);

regards,
dan carpenter


/*
 * Copyright (C) 2023 Oracle.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
 */

#include "smatch.h"
#include "smatch_slist.h"

static int my_id;

static void check_non_null(struct expression *expr, const char *name, struct symbol *sym, void *data)
{
	struct sm_state *sm, *tmp;
	sval_t sval;

	sm = get_sm_state(SMATCH_EXTRA, name, sym);
	if (!sm)
		return;

	FOR_EACH_PTR(sm->possible, tmp) {
		if (!estate_get_single_value(tmp->state, &sval) ||
		    sval.value != 0)
			continue;
		sm_warning("'%s' potentially NULL", name);
		return;
	} END_FOR_EACH_PTR(tmp);
}

void check_passing_possible_null(int id)
{
	my_id = id;

	add_function_param_key_hook_early("iounmap", &check_non_null, 0, "$", NULL);
}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux