lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 6 May 2011 21:43:44 +0900
From:	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To:	mattst88@...il.com
Cc:	mcree@...on.net.nz, linux-kernel@...r.kernel.org,
	linux-alpha@...r.kernel.org, rth@...ddle.net,
	ink@...assic.park.msu.ru
Subject: Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error
 in drm

On Wed, 4 May 2011 17:59:29 -0400
Matt Turner <mattst88@...il.com> wrote:

> Other architectures define this differently.
> 
> arch/ia64/include/asm/dma-mapping.h:#define DMA_ERROR_CODE 0
> arch/microblaze/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
>          (~(dma_addr_t)0x0)
> arch/powerpc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
>  (~(dma_addr_t)0x0)
> arch/sparc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
> (~(dma_addr_t)0x0)
> arch/x86/include/asm/dma-mapping.h:#define DMA_ERROR_CODE       0
> 
> Any idea what the reason is?

Because an invalid DMA address is architecture specific. To be exact,
an invalid DMA address is DMA operation specific.

As I wrote in another mail, this patch is wrong.

Architectures don't need to define DMA_ERROR_CODE.

Some architectures need multiple dma_mapping_error functions. You
could use DMA_ERROR_CODE in order to avoid duplicated code like
this. That is, you define only for dma_map_ops that needs the own
mapping_error function.

static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
	struct dma_map_ops *ops = get_dma_ops(dev);
	if (ops->mapping_error)
		return ops->mapping_error(dev, dma_addr);

	return (dma_addr == DMA_ERROR_CODE);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ