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]
Date:	Thu, 29 Oct 2015 23:24:32 +0200
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	Vitaly Kuznetsov <vkuznets@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Ulf Hansson <ulf.hansson@...aro.org>,
	James Bottomley <JBottomley@...n.com>,
	Kees Cook <keescook@...omium.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 2/4] lib/string_helpers.c: protect string_get_size()
 against blk_size=0

On Thu, Oct 29, 2015 at 6:30 PM, Vitaly Kuznetsov <vkuznets@...hat.com> wrote:
> Division by zero happens if blk_size=0 is supplied to string_get_size().
> Add WARN_ON() and set size to 0 to report '0 B'.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> ---
>  lib/string_helpers.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/lib/string_helpers.c b/lib/string_helpers.c
> index f6c27dc..ff3575b 100644
> --- a/lib/string_helpers.c
> +++ b/lib/string_helpers.c
> @@ -50,6 +50,11 @@ void string_get_size(u64 size, u32 blk_size, const enum string_size_units units,
>
>         tmp[0] = '\0';
>         i = 0;
> +
> +       /* Calling string_get_size() with blk_size=0 is wrong! */
> +       if (WARN_ON(!blk_size))
> +               size = 0;
> +
>         if (!size)
>                 goto out;
>
> --
> 2.4.3
>
> --
> 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/



-- 
With Best Regards,
Andy Shevchenko
--
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