Re: [PATCH] add additional audit info (read/write length & rngname) for RNG devices

From: Eric Paris
Date: Mon Dec 06 2010 - 10:53:57 EST


On Mon, 2010-12-06 at 09:32 -0600, Matt Mackall wrote:
> On Mon, 2010-12-06 at 10:21 -0500, Neil Horman wrote:

+int __audit_rng(const char *name, size_t len)
+{
+ struct audit_aux_data_rng *ax;
+ struct audit_context *context = current->audit_context;
[snip]
+ ax->d.next = context->aux;
+ context->aux = (void *)ax;
+ return 0;
+}


> > + context->aux = (void *)ax;
>
> Redundant cast to void *?

It's not redundant. ax is struct audit_aux_data_rng where the first
entry in the struct is a struct audit_aux_data. context->aux is a
struct audit_aux_data. The 'best' thing to do would really be to do
something like:

context->aux = &(ax->d);

Second best would be:

context->aux = (struct audit_aux_data *)ax;

Third best would be what we have. But since the rest of the aux
structures in the audit code do it this way we do it this way for
consistency. If we ever fix the rest to do it like the 'best' example
we'll update this one, but I'd rather have consistency that have only
this 'one' be 'more correct'

-Eric

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/