Sizes for free() in the Enhanced SpeedStep driver

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Sizes for free() in the Enhanced SpeedStep driver

Frederic Cambus
Hi tech@,

Add sizes for free() in the i386 version of the Enhanced SpeedStep driver.

It was already done on amd64, but not on i386. Tested on an Atom N270.

Comments? OK?

Index: sys/arch/i386/i386/est.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/est.c,v
retrieving revision 1.48
diff -u -p -r1.48 est.c
--- sys/arch/i386/i386/est.c 7 Mar 2016 05:32:46 -0000 1.48
+++ sys/arch/i386/i386/est.c 20 Jan 2018 17:53:44 -0000
@@ -1036,7 +1036,7 @@ est_acpi_pss_changed(struct acpicpu_pss
  needtran = 0;
  }
 
- free(est_fqlist->table, M_DEVBUF, 0);
+ free(est_fqlist->table, M_DEVBUF, npss * sizeof(struct est_op));
  free(est_fqlist, M_DEVBUF, sizeof *est_fqlist);
  est_fqlist = acpilist;
 
@@ -1141,7 +1141,7 @@ est_init(struct cpu_info *ci, int vendor
 
  if ((fake_table = mallocarray(3, sizeof(struct est_op),
     M_DEVBUF, M_NOWAIT)) == NULL) {
- free(fake_fqlist, M_DEVBUF, 0);
+ free(fake_fqlist, M_DEVBUF, sizeof(struct fqlist));
  printf("%s: EST: cannot allocate memory for fake "
     "table\n", cpu_device);
  return;
@@ -1206,7 +1206,7 @@ nospeedstep:
  * it can't fail in that case and therefore can't reach here.
  */
  free(est_fqlist->table, M_DEVBUF, 0);
- free(est_fqlist, M_DEVBUF, 0);
+ free(est_fqlist, M_DEVBUF, sizeof(*est_fqlist));
 }
 
 void