Re: [PATCH 06/19] Add ioctl() argument and attribute handling utils

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- "Stefan Richter" <stefanr@xxxxxxxxxxxxxxxxx> wrote:
> Miloslav Trmač wrote:
> > --- /dev/null
> > +++ b/crypto/userspace/utils.c
> [...]
> > +#ifdef CONFIG_COMPAT
> > +/* max() is too clever for compile-time constants */
> > +#define CONST_MAX(A, B) ((A) > (B) ? (A) : (B))
> > +
> > +#define MAX_SESSION_INPUT_DATA_SIZE					\
> > +	(CONST_MAX(sizeof(struct ncr_session_input_data),		\
> > +		   sizeof(struct compat_ncr_session_input_data)))
> > +#define MAX_SESSION_OUTPUT_BUFFER_SIZE					\
> > +	(CONST_MAX(sizeof(struct ncr_session_output_buffer),		\
> > +		   sizeof(struct compat_ncr_session_output_buffer)))
> > +
> > +#else /* !CONFIG_COMPAT */
> > +
> > +#define MAX_SESSION_INPUT_DATA_SIZE (sizeof(struct ncr_session_input_data))
> > +#define MAX_SESSION_OUTPUT_BUFFER_SIZE			\
> > +	(sizeof(struct ncr_session_output_buffer))
> > +
> > +#endif /* !CONFIG_COMPAT */
> 
> struct compat_xyz cannot be bigger than struct xyz, can it?
Perhaps not, but the code has been written and it's easier to keep it than to speculate :)  It also helps document the fact that the data format depends on properties of the userspace.
    Mirek
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux