On 28.07.2011 6:40, Jason Hellenthal wrote: >> + uint32_t dsn; >> + >> + if (gpp->gpp_codesize != MBRSIZE) >> + return (ENODEV); > > Is it known for an absolute fact that the size being written is always > going to be the size of MBRSIZE ? never less ? wouldnt ">=" greater-than > or equal make sense here ? though I would seriously doubt it needs to > return on equal too as that could be written.
Yes. Now the size of bootcode must be equal to MBRSIZE. We do not have any of bootcode images with size different than MBRSIZE. If you want to write bootcode with size less than MBRSIZE, then just fill up your image with zeroes to MBRSIZE. >> - codesz = DOSPARTOFF; >> table = (struct g_part_mbr_table *)basetable; >> - bzero(table->mbr, codesz); >> - codesz = MIN(codesz, gpp->gpp_codesize); >> - if (codesz > 0) >> - bcopy(gpp->gpp_codeptr, table->mbr, codesz); >> + dsn = *(uint32_t *)(table->mbr + DOSDSNOFF); >> + bcopy(gpp->gpp_codeptr, table->mbr, DOSPARTOFF); >> + if (dsn != 0) > > Shit happens... any case that the product might return less than 0 > causing this to still fall through and process... ? ">" ? Variable with type uint32_t could not be less than zero. This code only restores old DSN if it is not zero. In any other cases you can use boot0cfg(8) to set or change it. -- WBR, Andrey V. Elsukov
signature.asc
Description: OpenPGP digital signature
