[PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names.

Rafał Miłecki zajec5 at gmail.com
Thu May 5 08:12:34 PDT 2022

On 5.05.2022 16:33, Ole Kristian Lona wrote:
> I removed those "const" qualifiers to get rid of the error message about "assignments discards 'const' qualifiers"... If I in addition make flash_partition_entry a const, the file won't compile any more, since we are adjusting the value of flash_partition_entry "info->partitions" in line 3360.
> I tried a few different variants of using "const", but could not find a combination that actually works, and yields no error message.

Please doble verify that. Do you really get any warnings with change as below?

I just tested it and it seems to work

diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c
index 93b2450..526f709 100644
--- a/src/tplink-safeloader.c
+++ b/src/tplink-safeloader.c
@@ -48,18 +48,18 @@ struct image_partition_entry {

  /** A flash partition table entry */
  struct flash_partition_entry {
-	char *name;
+	const char *name;
  	uint32_t base;
  	uint32_t size;

  /** Flash partition names table entry */
  struct factory_partition_names {
-	char *partition_table;
-	char *soft_ver;
-	char *os_image;
-	char *file_system;
-	char *extra_para;
+	const char *partition_table;
+	const char *soft_ver;
+	const char *os_image;
+	const char *file_system;
+	const char *extra_para;

  /** Partition trailing padding definitions

More information about the openwrt-devel mailing list