Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc5214ee authored by Jan Sokolowski's avatar Jan Sokolowski Committed by Doug Ledford
Browse files

IB/hfi1: Handle missing magic values in config file



Driver does not check whether proper configuration file exist in EPROM,
and treats empty partition as possible valid configuration, preventing
fallback to default firmware. Change EPROM read function to treat
missing magic number as read error.

Reviewed-by: default avatarJakub Byczkowski <jakub.byczkowski@intel.com>
Signed-off-by: default avatarJan Sokolowski <jan.sokolowski@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent f683c80c
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -250,7 +250,6 @@ static int read_partition_platform_config(struct hfi1_devdata *dd, void **data,
{
	void *buffer;
	void *p;
	u32 length;
	int ret;

	buffer = kmalloc(P1_SIZE, GFP_KERNEL);
@@ -265,13 +264,13 @@ static int read_partition_platform_config(struct hfi1_devdata *dd, void **data,

	/* scan for image magic that may trail the actual data */
	p = strnstr(buffer, IMAGE_TRAIL_MAGIC, P1_SIZE);
	if (p)
		length = p - buffer;
	else
		length = P1_SIZE;
	if (!p) {
		kfree(buffer);
		return -ENOENT;
	}

	*data = buffer;
	*size = length;
	*size = p - buffer;
	return 0;
}