/* Log an early allocated block and populate the stack trace.  */
static void early_alloc(struct early_log *log)
/* Log an early allocated block and populate the stack trace.  */
static void early_alloc(struct early_log *log)
{
	struct kmemleak_object *object;
	unsigned long flags;
	int i;
	if (!atomic_read(&kmemleak_enabled) || !log->ptr || IS_ERR(log->ptr))
		return;
	rcu_read_lock();
	object = create_object((unsigned long)log->ptr, log->size,
			       log->min_count, GFP_ATOMIC);
	if (!object)
		goto out;
	spin_lock_irqsave(&object->lock, flags);
	for (i = 0; i < log->trace_len; i++)
		object->trace[i] = log->trace[i];
	object->trace_len = log->trace_len;
	spin_unlock_irqrestore(&object->lock, flags);
out:
	rcu_read_unlock();
}