linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fat: Relax checks for sector size and media type
Date: Mon, 03 Sep 2018 16:17:26 +0900	[thread overview]
Message-ID: <87bm9ft5h5.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20180902131932.11558-1-pali.rohar@gmail.com> ("Pali =?iso-8859-1?Q?Roh=E1r=22's?= message of "Sun, 2 Sep 2018 15:19:32 +0200")

Pali Roh�r <pali.rohar@gmail.com> writes:

> Windows fastfat.sys driver accepts also media types 0x00 and 0x01 and
> sector sizes 128 and 256 bytes. Linux mkfs.fat can format disk also to
> larger FAT sector sizes then 4096 bytes, therefore relax also upper limit
> restriction.

> -	if (!is_power_of_2(bpb->fat_sector_size)
> -	    || (bpb->fat_sector_size < 512)
> -	    || (bpb->fat_sector_size > 4096)) {
> +	if (!is_power_of_2(bpb->fat_sector_size)) {

Just relaxing validation doesn't work. The block layer doesn't support
smaller than 512, and lager than PAGE_SIZE.  (And in specification, fat
doesn't support lager than 4096.)

>  static inline int fat_valid_media(u8 media)
>  {
> -	return 0xf8 <= media || media == 0xf0;
> +	return 0xf8 <= media || media == 0xf0 || media == 0x00 || media == 0x01;
>  }
>  #endif /* !_LINUX_MSDOS_FS_H */

This is ok though, this would be for ancient floppy media.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2018-09-03  7:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-02 13:19 [PATCH] fat: Relax checks for sector size and media type Pali Rohár
2018-09-03  7:17 ` OGAWA Hirofumi [this message]
2018-09-03  7:40   ` Pali Rohár
2018-09-03  8:01     ` OGAWA Hirofumi
2018-09-03  8:04       ` Pali Rohár
2018-09-03  8:19         ` OGAWA Hirofumi
2018-09-12 10:17           ` Pali Rohár
2018-09-12 10:36             ` OGAWA Hirofumi

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=87bm9ft5h5.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali.rohar@gmail.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;
as well as URLs for NNTP newsgroup(s).