RE: [PATCH Resend] - SN: validate smp_affinity mask on intr redirect

From: Luck, Tony
Date: Tue May 08 2007 - 14:03:31 EST



+#ifndef is_affinity_mask_valid
+#define is_affinity_mask_valid() 1
+#endif
+
int no_irq_affinity;
static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
unsigned long count, void *data)
@@ -42,6 +46,9 @@ static int irq_affinity_write_proc(struc
if (err)
return err;

+ if (!is_affinity_mask_valid(new_value))
+ return -EINVAL;

This results in a warning:
kernel/irq/proc.c:49: warning: implicit declaration of function `is_affinity_mask_valid'

I can't put a declaration for is_affinity_mask_valid into
include/asm-ia64/irq.h because that results in errors in
files that include this, but don't have a definition for
cpumask_t.

I could add the declaration as a #else clause to that
#ifndef in kernel/irq/proc.c, but that would no doubt
result is complaints from the style police that function
prototypes belong in header files, not in ".c" files.

Last option is to move the #if to linux/irq.h:

#ifndef is_affinity_mask_valid
#define is_affinity_mask_valid 1
#else
extern bool is_affinity_mask_valid(cpumask_t cpumask);
#endif

But that seems to spoil the whole tricksiness factor and
doesn't really look any better that using ARCH_HAS_IRQ_AFFINITY_MASK_CHECK

-Tony
-
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/