[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <001901d5c743$eff08030$cfd18090$@samsung.com>
Date: Fri, 10 Jan 2020 08:24:27 +0900
From: "Namjae Jeon" <namjae.jeon@...sung.com>
To: "'Christoph Hellwig'" <hch@....de>
Cc: <linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
<gregkh@...uxfoundation.org>, <valdis.kletnieks@...edu>,
<sj1557.seo@...sung.com>, <linkinjeon@...il.com>,
<pali.rohar@...il.com>
Subject: RE: [PATCH v9 06/13] exfat: add exfat entry operations
> > +int exfat_ent_get(struct super_block *sb, unsigned int loc,
> > + unsigned int *content)
> > +{
> > + struct exfat_sb_info *sbi = EXFAT_SB(sb);
> > + int err;
> > +
> > + if (!is_valid_cluster(sbi, loc)) {
> > + exfat_fs_error(sb, "invalid access to FAT (entry 0x%08x)",
> > + loc);
> > + return -EIO;
> > + }
> > +
> > + err = __exfat_ent_get(sb, loc, content);
> > + if (err) {
> > + exfat_fs_error(sb,
> > + "failed to access to FAT (entry 0x%08x, err:%d)",
> > + loc, err);
> > + return err;
> > + }
> > +
> > + if (!is_reserved_cluster(*content) &&
> > + !is_valid_cluster(sbi, *content)) {
> > + exfat_fs_error(sb,
> > + "invalid access to FAT (entry 0x%08x) bogus content
> (0x%08x)",
> > + loc, *content);
> > + return -EIO;
> > + }
> > +
> > + if (*content == EXFAT_FREE_CLUSTER) {
> > + exfat_fs_error(sb,
> > + "invalid access to FAT free cluster (entry 0x%08x)",
> > + loc);
> > + return -EIO;
> > + }
> > +
> > + if (*content == EXFAT_BAD_CLUSTER) {
> > + exfat_fs_error(sb,
> > + "invalid access to FAT bad cluster (entry 0x%08x)",
> > + loc);
> > + return -EIO;
> > + }
> > + return 0;
>
> Maybe these explicit checks should move up, and then is_reserved_cluster
> can be replaced with an explicit check just for EXFAT_EOF_CLUSTER?
Right, Will fix it on v10.
>
> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@....de>
Thanks!
Powered by blists - more mailing lists