kernel: mtdsplit_uimage: fix Edimax parser
According to the author the code was added to in preparation for adding support for a new board. The patch for the board was never send and the code never really tested. The edimax header starting with the edimax magic is put in front of the uImage header. There is no special uImage header used. Means, default magic and the type field is set to kernel as usual. Signed-off-by: Mathias Kresin <dev@kresin.me> edimax parser fix
This commit is contained in:
parent
35073d47bb
commit
634d690d74
@ -310,27 +310,21 @@ static struct mtd_part_parser uimage_netgear_parser = {
|
||||
|
||||
static ssize_t uimage_find_edimax(u_char *buf, size_t len)
|
||||
{
|
||||
struct uimage_header *header;
|
||||
u32 *magic;
|
||||
|
||||
if (len < FW_EDIMAX_OFFSET + sizeof(*header)) {
|
||||
if (len < FW_EDIMAX_OFFSET + sizeof(struct uimage_header)) {
|
||||
pr_err("Buffer too small for checking Edimax header\n");
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
header = (struct uimage_header *)(buf + FW_EDIMAX_OFFSET);
|
||||
|
||||
switch be32_to_cpu(header->ih_magic) {
|
||||
case FW_MAGIC_EDIMAX:
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (header->ih_os != IH_OS_LINUX ||
|
||||
header->ih_type != IH_TYPE_FILESYSTEM)
|
||||
magic = (u32 *)buf;
|
||||
if (be32_to_cpu(*magic) != FW_MAGIC_EDIMAX)
|
||||
return -EINVAL;
|
||||
|
||||
return FW_EDIMAX_OFFSET;
|
||||
if (!uimage_verify_default(buf + FW_EDIMAX_OFFSET, len))
|
||||
return FW_EDIMAX_OFFSET;
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user