[RFC PATCH 7/8] KEYS: Reject @datalen values over INT_MAX

Jarkko Sakkinen jarkko at kernel.org
Mon Oct 19 16:35:20 UTC 2026


On Mon, Oct 19, 2026 at 04:43:27PM +0100, David Howells wrote:
> Jarkko Sakkinen <jarkko at kernel.org> wrote:
> 
> > -	int delta = (int)datalen - key->datalen;
> > +	int delta;
> >  	int ret = 0;
> >  
> >  	key_check(key);
> >  
> > +	if (datalen > INT_MAX)
> > +		return -EINVAL;
> > +
> > +	delta = (int)datalen - key->datalen;
> > +
> 
> You don't actually need to move the subtraction.

Ouch, you're right, I'll fixup that.

> 
> But apart from that:
> 
> Signed-off-by: David Howells <dhowells at redhat.com>

Br, Jarkko



More information about the Linux-security-module-archive mailing list