Skip to contentSkip to conversation

makedumpfile: remove the double free of sph

PATCH In review Chao Fan 3 participants 3 messages Aug 26, 2015

Subsystems (2)
lore
Share & tools
lore

Chao Fan

author
#0 lore raw

PATCH 1/1 makedumpfile: remove the double free of sph

sph will be freed twice when it meet below conditions:

            sph->signature1 != SADUMP_SIGNATURE1 ||
            sph->signature2 != SADUMP_SIGNATURE2

Then it will be freed once and goto error: to free again. So remove the 1st free.

---
 sadump_info.c | 1 -
 1 file changed, 1 deletion(-)
sadump_info.c +0 -1
index e8154f4..1474fb2 100644
@@ -695,7 +695,6 @@ read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi)
 	if (sph->signature1 != SADUMP_SIGNATURE1 ||
 	    sph->signature2 != SADUMP_SIGNATURE2) {
 		DEBUG_MSG("sadump: does not have partition header\n");
-		free(sph);
 		goto error;
 	}
 
Signature · 7 lines
2.4.3


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Chao Fan

sph will be freed twice when it meet below conditions:

             sph->signature1 != SADUMP_SIGNATURE1 ||
             sph->signature2 != SADUMP_SIGNATURE2

Then it will be freed once and goto error: to free again. So remove the 1st free.

---
  sadump_info.c | 1 -
  1 file changed, 1 deletion(-)
sadump_info.c +0 -0
index e8154f4..1474fb2 100644

sadump_info.c read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi) · line 700

Quoted 7 lines
sadump_info.c +0 -1
@@ -695,7 +695,6 @@ read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi)
  	if (sph->signature1 != SADUMP_SIGNATURE1 ||
  	    sph->signature2 != SADUMP_SIGNATURE2) {
  		DEBUG_MSG("sadump: does not have partition header\n");
-		free(sph);
  		goto error;
  	}
 

Thanks! It looks good to me.

Signature · 8 lines
Thanks.
HATAYAMA, Daisuke


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

Hello,

Quoted 30 lines · Chao Fan
Quoted 19 lines

sph will be freed twice when it meet below conditions:

             sph->signature1 != SADUMP_SIGNATURE1 ||
             sph->signature2 != SADUMP_SIGNATURE2

Then it will be freed once and goto error: to free again. So remove the 1st free.

---
  sadump_info.c | 1 -
  1 file changed, 1 deletion(-)
sadump_info.c +0 -0
index e8154f4..1474fb2 100644

sadump_info.c read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi) · line 700

Quoted 7 lines
sadump_info.c +0 -1
@@ -695,7 +695,6 @@ read_sadump_header_diskset(int diskid, struct sadump_diskset_info *sdi)
  	if (sph->signature1 != SADUMP_SIGNATURE1 ||
  	    sph->signature2 != SADUMP_SIGNATURE2) {
  		DEBUG_MSG("sadump: does not have partition header\n");
-		free(sph);
  		goto error;
  	}
 

Thanks! It looks good to me.

Quoted 5 lines

--
Thanks.
HATAYAMA, Daisuke

I'll merge this patch into v1.5.9, thanks.

Regards,
Atsushi Kumagai

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec