lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALMYJDua65PKyC4R+RdX8TxX8JFw3LX4h8dxxcExyiUboMwCvg@mail.gmail.com>
Date:	Fri, 24 May 2013 08:50:10 +0530
From:	Santosh Y <santoshsy@...il.com>
To:	Libo Chen <clbchenlibo.chen@...wei.com>
Cc:	megaraidlinux@....com, JBottomley@...allels.com,
	linux-scsi@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
	kashyap.desai@....com, aradford@...il.com,
	Li Zefan <lizefan@...wei.com>
Subject: Re: [PATCH] scsi: megaraid: check kzalloc

On Fri, May 24, 2013 at 7:52 AM, Libo Chen <clbchenlibo.chen@...wei.com> wrote:
>
> we should check kzalloc, avoid to hit oops
>
> Signed-off-by: Libo Chen <libo.chen@...wei.com>
> ---
>  drivers/scsi/megaraid.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
> index 846f475..195b095 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -4162,6 +4162,10 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
>
>         sdev = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
>         scmd->device = sdev;
                              ^^^^^^
I guess assigning after the NULL check of 'sdev' is more appropriate.

> +       if (!scmd->device) {
> +               scsi_free_command(GFP_KERNEL, scmd);
> +               return -ENOMEM;
> +       }
>
>         memset(adapter->int_cdb, 0, sizeof(adapter->int_cdb));
>         scmd->cmnd = adapter->int_cdb;
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
~Santosh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ