[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-arm
Subject:    missing M_ZERO malloc flag in src/sys/arm/arm/busdma_machdep.c
From:       fate <fate10 () gmail ! com>
Date:       2007-05-15 0:41:09
Message-ID: 7b8b6fbc0705141741n4ee98fateb5ab34a2f307a6c () mail ! gmail ! com
[Download RAW message or body]

Hi,
It would be good to apply this small patch:

*** busdma_machdep.c.orig
--- busdma_machdep.c
***************
*** 345,351 ****
        if (!parent)
                parent = arm_root_dma_tag;

!       newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT);
        if (newtag == NULL) {
                CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d",
                    __func__, newtag, 0, error);
--- 345,351 ----
        if (!parent)
                parent = arm_root_dma_tag;

!       newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF,
M_NOWAIT | M_ZERO);
        if (newtag == NULL) {
                CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d",
                    __func__, newtag, 0, error);

or the structure newtag would not be initialized correctly in case of
dirty memory and failed on this if block:

		if (dmat->bounce_zone == NULL) {
			if ((error = alloc_bounce_zone(dmat)) != 0) {
				_busdma_free_dmamap(newmap);
				*mapp = NULL;
				return (error);
			}
		}

left bounce_zone unallocated with kernel crash as result

SY, Vladimir Belian
_______________________________________________
freebsd-arm@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic