lkml.org 
[lkml]   [2019]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 13/16] block: sed-opal: check size of shadow mbr
On Thu, Jan 17, 2019 at 09:31:53PM +0000, David Kozub wrote:
> From: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
>
> Check whether the shadow mbr does fit in the provided space on the
> target. Also a proper firmware should handle this case and return an
> error we may prevent problems or even damage with crappy firmwares.
> + len = response_get_u64(&dev->parsed, 4);
> + if (shadow->offset + shadow->size > len) {
> + pr_debug("MBR: does not fit in shadow (%llu vs. %llu)\n",
> + shadow->offset + shadow->size, len);
> + return -ENOSPC;
> + }

Can we please change this check to the following:

if (shadow->size > len || shadow->offset > len - shadow->size)

Thanks

> --
> 2.20.1
>
>

\
 
 \ /
  Last update: 2019-01-19 18:30    [W:0.152 / U:5.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site