misc: mic: Fix user space namespace pollution from mic_common.h.
Avoid declaring ALIGN() and __aligned() in include/uapi/linux/mic_common.h since they pollute user space namespace. Also, mic_aligned_size() can be simply replaced simply by sizeof() since all structures where mic_aligned_size() is used are declared using __attribute__ ((aligned(8))); -- >From mail from H Peter Anvin about this: On Fri, Nov 08, 2013 H Peter Anvin <h.peter.anvin@intel.com> wrote: Subject: Namespace pollution in mic_common.h This puts two macros, ALIGN() and __aligned(), into arbitrary user space namespace. This really isn't safe or acceptable, especially since those symbols are highly generic. ... When these structures are forced-aligned, they will in fact have padding automatically added by the compiler to an 8-byte boundary anyway, so mic_aligned_size() does nothing. ... Reported-by: H Peter Anvin <h.peter.anvin@intel.com> Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Цей коміт міститься в:

зафіксовано
Greg Kroah-Hartman

джерело
286c24028c
коміт
1e31aa9270
@@ -42,8 +42,8 @@
|
||||
|
||||
static inline unsigned mic_desc_size(struct mic_device_desc __iomem *desc)
|
||||
{
|
||||
return mic_aligned_size(*desc)
|
||||
+ ioread8(&desc->num_vq) * mic_aligned_size(struct mic_vqconfig)
|
||||
return sizeof(*desc)
|
||||
+ ioread8(&desc->num_vq) * sizeof(struct mic_vqconfig)
|
||||
+ ioread8(&desc->feature_len) * 2
|
||||
+ ioread8(&desc->config_len);
|
||||
}
|
||||
@@ -67,8 +67,7 @@ mic_vq_configspace(struct mic_device_desc __iomem *desc)
|
||||
}
|
||||
static inline unsigned mic_total_desc_size(struct mic_device_desc __iomem *desc)
|
||||
{
|
||||
return mic_aligned_desc_size(desc) +
|
||||
mic_aligned_size(struct mic_device_ctrl);
|
||||
return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl);
|
||||
}
|
||||
|
||||
int mic_devices_init(struct mic_driver *mdrv);
|
||||
|
Посилання в новій задачі
Заблокувати користувача