From: Dan Carpenter <error27@gmail.com>
To: lishuchang@hust.edu.cn
Cc: James Smart <james.smart@broadcom.com>,
Dick Kennedy <dick.kennedy@broadcom.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
hust-os-kernel-patches@googlegroups.com,
Dongliang Mu <dzm91@hust.edu.cn>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: lpfc: fix ioremap issues in 'lpfc_sli4_pci_mem_setup'
Date: Mon, 3 Apr 2023 12:16:16 +0300 [thread overview]
Message-ID: <6df77fb0-6b3d-4e3b-9c5a-40e217e8dae9@kili.mountain> (raw)
In-Reply-To: <20230403074821.5121-1-lishuchang@hust.edu.cn>
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
On Mon, Apr 03, 2023 at 03:48:21PM +0800, lishuchang@hust.edu.cn 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
[-- Attachment #2: check_passing_possible_null.c --]
[-- Type: text/x-csrc, Size: 1314 bytes --]
/*
* 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);
}
next prev parent reply other threads:[~2023-04-03 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 7:48 lishuchang
2023-04-03 9:16 ` Dan Carpenter [this message]
2023-04-03 10:30 ` Dongliang Mu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6df77fb0-6b3d-4e3b-9c5a-40e217e8dae9@kili.mountain \
--to=error27@gmail.com \
--cc=dick.kennedy@broadcom.com \
--cc=dzm91@hust.edu.cn \
--cc=hust-os-kernel-patches@googlegroups.com \
--cc=james.smart@broadcom.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lishuchang@hust.edu.cn \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®