int hasmag = 0;
int rc = 1; /* = nothing detected */
- if (id->minsz && id->minsz > pr->size)
+ if (pr->size <= 0 || (id->minsz && id->minsz > pr->size))
goto nothing; /* the device is too small */
mag = id->magics ? &id->magics[0] : NULL;
{
int rc;
- if (!pr && !chn)
+ if (!pr || !chn)
return NULL;
pr->cur_chain = chn;
struct list_head *p;
struct blkid_bufinfo *bf = NULL;
+ if (pr->size <= 0)
+ return NULL;
+
list_for_each(p, &pr->buffers) {
struct blkid_bufinfo *x =
list_entry(p, struct blkid_bufinfo, bufs);
pr->size -= pr->off;
}
- if (!pr->size)
- goto err;
DBG(DEBUG_LOWPROBE, printf("ready for low-probing, offset=%zd, size=%zd\n",
pr->off, pr->size));
pr->off = off;
pr->size = size;
+ pr->flags &= ~BLKID_TINY_DEV;
+
+ if (pr->size <= 1440 * 1024 && !S_ISCHR(pr->mode))
+ pr->flags |= BLKID_TINY_DEV;
blkid_probe_reset_buffer(pr);
printf("--> starting probing loop [SUBLKS idx=%d]\n",
chn->idx));
- if (pr->size <= 1024 && !S_ISCHR(pr->mode))
+ if (pr->size <= 0 || (pr->size <= 1024 && !S_ISCHR(pr->mode)))
/* Ignore very very small block devices or regular files (e.g.
* extended partitions). Note that size of the UBI char devices
* is 1 byte */