ac6e56e6d7
23900-xzalloc.patch 24144-cpufreq-turbo-crash.patch 24148-shadow-pgt-dying-op-performance.patch 24155-x86-ioapic-EOI-after-migration.patch 24156-x86-ioapic-shared-vectors.patch 24157-x86-xstate-init.patch 24168-x86-vioapic-clear-remote_irr.patch - submit fixes for bnc#649209 and bnc#711892 xl-create-pv-with-qcow2-img.patch update suspend_evtchn_lock.patch - Update trace.c, merge patches from upstream 23050-xentrace_dynamic_tracebuffer_allocation.patch 23091-xentrace_fix_t_info_pages_calculation..patch 23092-xentrace_print_calculated_numbers_in_calculate_tbuf_size.patch 23093-xentrace_remove_gdprintk_usage_since_they_are_not_in_guest_context.patch 23094-xentrace_update_comments.patch 23095-xentrace_use_consistent_printk_prefix.patch 23128-xentrace_correct_formula_to_calculate_t_info_pages.patch 23129-xentrace_remove_unneeded_debug_printk.patch 23173-xentrace_Move_register_cpu_notifier_call_into_boot-time_init..patch 23239-xentrace_correct_overflow_check_for_number_of_per-cpu_trace_pages.patch 23308-xentrace_Move_the_global_variable_t_info_first_offset_into_calculate_tbuf_size.patch 23309-xentrace_Mark_data_size___read_mostly_because_its_only_written_once.patch 23310-xentrace_Remove_unneeded_cast_when_assigning_pointer_value_to_dst.patch 23404-xentrace_reduce_trace_buffer_size_to_something_mfn_offset_can_reach.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=160
90 lines
2.7 KiB
Diff
90 lines
2.7 KiB
Diff
# HG changeset patch
|
|
# User Jan Beulich <jbeulich@suse.com>
|
|
# Date 1317730526 -7200
|
|
# Node ID e09ebf7a31f55bb26c3cce7695a435ed20adf05b
|
|
# Parent a99d75671a911f9c0d5d11e0fe88a0a65863cb44
|
|
introduce xzalloc() & Co
|
|
|
|
Rather than having to match a call to one of the xmalloc() flavors with
|
|
a subsequent memset(), introduce a zeroing variant of each of those
|
|
flavors.
|
|
|
|
Signed-off-by: Jan Beulich <jbeulich@suse.com>
|
|
Acked-by: Keir Fraser <keir@xen.org>
|
|
|
|
--- a/xen/common/xmalloc_tlsf.c
|
|
+++ b/xen/common/xmalloc_tlsf.c
|
|
@@ -585,6 +585,13 @@ void *_xmalloc(unsigned long size, unsig
|
|
return p;
|
|
}
|
|
|
|
+void *_xzalloc(unsigned long size, unsigned long align)
|
|
+{
|
|
+ void *p = _xmalloc(size, align);
|
|
+
|
|
+ return p ? memset(p, 0, size) : p;
|
|
+}
|
|
+
|
|
void xfree(void *p)
|
|
{
|
|
struct bhdr *b;
|
|
--- a/xen/include/acpi/platform/aclinux.h
|
|
+++ b/xen/include/acpi/platform/aclinux.h
|
|
@@ -77,10 +77,7 @@
|
|
#define acpi_thread_id struct vcpu *
|
|
|
|
#define ACPI_ALLOCATE(a) xmalloc_bytes(a)
|
|
-#define ACPI_ALLOCATE_ZEROED(a) ({ \
|
|
- void *p = xmalloc_bytes(a); \
|
|
- if ( p ) memset(p, 0, a); \
|
|
- p; })
|
|
+#define ACPI_ALLOCATE_ZEROED(a) xzalloc_bytes(a)
|
|
#define ACPI_FREE(a) xfree(a)
|
|
|
|
#endif /* __ACLINUX_H__ */
|
|
--- a/xen/include/xen/xmalloc.h
|
|
+++ b/xen/include/xen/xmalloc.h
|
|
@@ -8,19 +8,25 @@
|
|
|
|
/* Allocate space for typed object. */
|
|
#define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type)))
|
|
+#define xzalloc(_type) ((_type *)_xzalloc(sizeof(_type), __alignof__(_type)))
|
|
|
|
/* Allocate space for array of typed objects. */
|
|
#define xmalloc_array(_type, _num) \
|
|
((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
|
|
+#define xzalloc_array(_type, _num) \
|
|
+ ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))
|
|
|
|
/* Allocate untyped storage. */
|
|
-#define xmalloc_bytes(_bytes) (_xmalloc(_bytes, SMP_CACHE_BYTES))
|
|
+#define xmalloc_bytes(_bytes) _xmalloc(_bytes, SMP_CACHE_BYTES)
|
|
+#define xzalloc_bytes(_bytes) _xzalloc(_bytes, SMP_CACHE_BYTES)
|
|
|
|
/* Free any of the above. */
|
|
extern void xfree(void *);
|
|
|
|
/* Underlying functions */
|
|
extern void *_xmalloc(unsigned long size, unsigned long align);
|
|
+extern void *_xzalloc(unsigned long size, unsigned long align);
|
|
+
|
|
static inline void *_xmalloc_array(
|
|
unsigned long size, unsigned long align, unsigned long num)
|
|
{
|
|
@@ -30,6 +36,15 @@ static inline void *_xmalloc_array(
|
|
return _xmalloc(size * num, align);
|
|
}
|
|
|
|
+static inline void *_xzalloc_array(
|
|
+ unsigned long size, unsigned long align, unsigned long num)
|
|
+{
|
|
+ /* Check for overflow. */
|
|
+ if (size && num > UINT_MAX / size)
|
|
+ return NULL;
|
|
+ return _xzalloc(size * num, align);
|
|
+}
|
|
+
|
|
/*
|
|
* Pooled allocator interface.
|
|
*/
|