Re: [PATCH] fat: add a check to fat_add_new_entries

From: OGAWA Hirofumi
Date: Sun Jun 21 2020 - 13:56:51 EST


trix@xxxxxxxxxx writes:

> start_blknr = blknr = fat_clus_to_blknr(sbi, cluster[i]);
> last_blknr = start_blknr + sbi->sec_per_clus;
> +
> + /* overflow */
> + if (unlikely(last_blknr <= start_blknr)) {
> + err = -ENOMEM;
> + goto error_nomem;
> + }
> +

The cluster is 28bits and sec_per_clus is 8bits, so this should never
overflow actually. Is there no way to tell it to clang?

Thanks.
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>