- if ((unsigned)blkno >= 1 << (sizeof(int)*NBBY-PGSHIFT)) /* XXX */
- blkno = 1 << ((sizeof(int)*NBBY-PGSHIFT) + 1);
+ if (size > MAXBSIZE)
+ panic("getblk: size too big");
+ /*
+ * To prevent overflow of 32-bit ints when converting block
+ * numbers to byte offsets, blknos > 2^32 / DEV_BSIZE are set
+ * to the maximum number that can be converted to a byte offset
+ * without overflow. This is historic code; what bug it fixed,
+ * or whether it is still a reasonable thing to do is open to
+ * dispute. mkm 9/85
+ */
+ if ((unsigned)blkno >= 1 << (sizeof(int)*NBBY-DEV_BSHIFT))
+ blkno = 1 << ((sizeof(int)*NBBY-DEV_BSHIFT) + 1);