Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ptgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static inline void init_utf16(char *str, uint16_t *buf, unsigned bufsize)
static int gen_ptable(uint32_t signature, int nr)
{
struct pte pte[MBR_ENTRY_MAX];
unsigned long long start, len, sect = 0;
unsigned long long start, len, sect = kb_align ? 1 : sectors;
int i, fd, ret = -1;

memset(pte, 0, sizeof(struct pte) * MBR_ENTRY_MAX);
Expand All @@ -344,7 +344,7 @@ static int gen_ptable(uint32_t signature, int nr)
pte[i].active = ((i + 1) == active) ? 0x80 : 0;
pte[i].type = parts[i].type;

start = sect + sectors;
start = sect;
if (parts[i].start != 0) {
if (parts[i].start * 2 < start) {
fprintf(stderr, "Invalid start %lld for partition %d!\n",
Expand Down