lkml.org 
[lkml]   [2005]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] partitions/msdos.c


    On Sat, 26 Feb 2005, Uwe Bonnes wrote:
    >
    > Andrew,
    >
    > Andries> I think nobody uses such partitions seriously, but nevertheless
    > Andries> this should probably live in -mm for a while to see if anybody
    > Andries> complains.
    >
    > the partition table of the USB stick in question is valid:
    >
    > 1B0: 00 00 00 00 00 00 00 00 53 3F 3C B9 00 00 00 01 ........S?<.....
    > 1C0: 01 00 06 10 21 7D 25 00 00 00 DB F3 01 00 00 00 ....!}%.........
    > 1D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    > *
    > 1F0: 00 00 00 00 00 00 00 54 72 75 6D 70 4D 53 55 AA .......TrumpMSU.
    >
    > Entry 1 is a FAT partition of exactly the size of the stick, and entries 2
    > to 4 are empty, marked by id zero. However the manufacturer decided to put a
    > name string "Trump" ( /sbin/lsusb gives
    > Bus 004 Device 012: ID 090a:1bc0 Trumpion Microelectronics, Inc.) just before
    > the "55 AA" partition table magic and our code reads this string as a
    > (bogus) size for the fourth entry, taking it for real.

    Would it not make more sense to just sanity-check the size itself, and
    throw it out if the partition size (plus start) is bigger than the disk
    size?

    We already do that within extended partitions, ie we do

    if (offs + size > this_size)
    continue;

    to just ignore crap. For some reason we don't do this for the primary one
    (possibly because we don't trust disk size reporting, I guess).

    There might well be people use use partition type 0, just because they
    just never _set_ the partition type.. I don't think Linux has ever cared
    about any type except for the "extended partition" type, so checking for
    zero doesn't seem very safe..

    Linus
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2009-11-18 23:46    [W:4.115 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site