Re: size for free() in if_bwfm_pci.c

2018-01-03 Thread Patrick Wildt
On Wed, Jan 03, 2018 at 03:36:31PM +0800, Michael W. Bombardieri wrote:
> Hello,
> 
> In bwfm_pci_dmamem_alloc() and bwfm_pci_dmamem_free(), bdm points
> to a single struct not an array. When freeing it we can just use
> the struct size. Does this look correct?

Yes, thanks, committed!

> 
> - Michael
> 
> 
> Index: if_bwfm_pci.c
> ===
> RCS file: /cvs/src/sys/dev/pci/if_bwfm_pci.c,v
> retrieving revision 1.3
> diff -u -p -u -r1.3 if_bwfm_pci.c
> --- if_bwfm_pci.c 1 Jan 2018 22:41:56 -   1.3
> +++ if_bwfm_pci.c 3 Jan 2018 07:26:39 -
> @@ -752,7 +752,7 @@ free:
>  destroy:
>   bus_dmamap_destroy(sc->sc_dmat, bdm->bdm_map);
>  bdmfree:
> - free(bdm, M_DEVBUF, 0);
> + free(bdm, M_DEVBUF, sizeof(*bdm));
>  
>   return (NULL);
>  }
> @@ -763,7 +763,7 @@ bwfm_pci_dmamem_free(struct bwfm_pci_sof
>   bus_dmamem_unmap(sc->sc_dmat, bdm->bdm_kva, bdm->bdm_size);
>   bus_dmamem_free(sc->sc_dmat, >bdm_seg, 1);
>   bus_dmamap_destroy(sc->sc_dmat, bdm->bdm_map);
> - free(bdm, M_DEVBUF, 0);
> + free(bdm, M_DEVBUF, sizeof(*bdm));
>  }
>  
>  /*
> 



size for free() in if_bwfm_pci.c

2018-01-02 Thread Michael W. Bombardieri
Hello,

In bwfm_pci_dmamem_alloc() and bwfm_pci_dmamem_free(), bdm points
to a single struct not an array. When freeing it we can just use
the struct size. Does this look correct?

- Michael


Index: if_bwfm_pci.c
===
RCS file: /cvs/src/sys/dev/pci/if_bwfm_pci.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 if_bwfm_pci.c
--- if_bwfm_pci.c   1 Jan 2018 22:41:56 -   1.3
+++ if_bwfm_pci.c   3 Jan 2018 07:26:39 -
@@ -752,7 +752,7 @@ free:
 destroy:
bus_dmamap_destroy(sc->sc_dmat, bdm->bdm_map);
 bdmfree:
-   free(bdm, M_DEVBUF, 0);
+   free(bdm, M_DEVBUF, sizeof(*bdm));
 
return (NULL);
 }
@@ -763,7 +763,7 @@ bwfm_pci_dmamem_free(struct bwfm_pci_sof
bus_dmamem_unmap(sc->sc_dmat, bdm->bdm_kva, bdm->bdm_size);
bus_dmamem_free(sc->sc_dmat, >bdm_seg, 1);
bus_dmamap_destroy(sc->sc_dmat, bdm->bdm_map);
-   free(bdm, M_DEVBUF, 0);
+   free(bdm, M_DEVBUF, sizeof(*bdm));
 }
 
 /*