Skip to content

Commit e30e203

Browse files
author
Benjamin Fogle
committed
Format cleanup
1 parent 1925e0a commit e30e203

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

mythril/src/linux.rs

+17-11
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,15 @@ pub fn load_linux(
9999
}
100100

101101
let protocol = LittleEndian::read_u16(&kernel[offsets::BOOTP_VERSION]);
102-
let (real_addr, cmdline_addr, prot_addr) =
103-
if protocol < 0x200 || (kernel[offsets::LOAD_FLAGS] & LoadFlags::LOADED_HIGH.bits()) == 0 {
104-
(0x90000, 0x9a000 - cmdline.len() as i32, 0x10000)
105-
} else if protocol < 0x202 {
106-
(0x90000, 0x9a000 - cmdline.len() as i32, 0x100000)
107-
} else {
108-
(0x10000, 0x20000, 0x100000)
109-
};
102+
let (real_addr, cmdline_addr, prot_addr) = if protocol < 0x200
103+
|| (kernel[offsets::LOAD_FLAGS] & LoadFlags::LOADED_HIGH.bits()) == 0
104+
{
105+
(0x90000, 0x9a000 - cmdline.len() as i32, 0x10000)
106+
} else if protocol < 0x202 {
107+
(0x90000, 0x9a000 - cmdline.len() as i32, 0x100000)
108+
} else {
109+
(0x10000, 0x20000, 0x100000)
110+
};
110111

111112
info!("Protocol = 0x{:x}", protocol);
112113

@@ -133,10 +134,15 @@ pub fn load_linux(
133134
builder.add_i32(FwCfgSelector::CMDLINE_SIZE, cmdline.len() as i32);
134135

135136
if protocol >= 0x202 {
136-
LittleEndian::write_i32(&mut kernel[offsets::CMD_LINE_PTR], cmdline_addr);
137+
LittleEndian::write_i32(
138+
&mut kernel[offsets::CMD_LINE_PTR],
139+
cmdline_addr,
140+
);
137141
} else {
138-
LittleEndian::write_u16(&mut kernel[offsets::OLD_CMD_LINE_MAGIC],
139-
OLD_CMD_LINE_MAGIC_VALUE);
142+
LittleEndian::write_u16(
143+
&mut kernel[offsets::OLD_CMD_LINE_MAGIC],
144+
OLD_CMD_LINE_MAGIC_VALUE,
145+
);
140146
LittleEndian::write_i16(
141147
&mut kernel[offsets::OLD_CMD_LINE_OFFSET],
142148
(cmdline_addr - real_addr) as i16,

0 commit comments

Comments
 (0)