Re: [PATCH 1/4] drm/ttm: add multihop infrastrucutre (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 09.11.20 um 16:16 schrieb Ville Syrjälä:
On Wed, Nov 11, 2020 at 06:13:02PM +0100, Christian König wrote:
Am 09.11.20 um 01:54 schrieb Dave Airlie:
@@ -1432,15 +1479,18 @@ int ttm_bo_swapout(struct ttm_operation_ctx *ctx)
   	if (bo->mem.mem_type != TTM_PL_SYSTEM) {
   		struct ttm_operation_ctx ctx = { false, false };
   		struct ttm_resource evict_mem;
+		struct ttm_place hop = {};
Please always use memset() if you want to zero initialize something in
the kernel, we had enough trouble with that.
What trouble is that? I've not heard of anything, and we use
={} quite extensively in drm land.

={} initializes only named fields, not padding.

The result is that for example when doing a hash or CRC of a structure you can come up with different results depending on the architecture and/or structure layout.

Another problem are information leaks from the kernel to userspace because of this.

Because of this Mesa for example strongly discourages using ={} for zeroing a structure.

Regards,
Christian.

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux