Skip to content

Commit baf76f0

Browse files
committed
slip: make slhc_free() silently accept an error pointer
This way, slhc_free() accepts what slhc_init() returns, whether that is an error or not. In particular, the pattern in sl_alloc_bufs() is slcomp = slhc_init(16, 16); ... slhc_free(slcomp); for the error handling path, and rather than complicate that code, just make it ok to always free what was returned by the init function. That's what the code used to do before commit 4ab42d7 ("ppp, slip: Validate VJ compression slot parameters completely") when slhc_init() just returned NULL for the error case, with no actual indication of the details of the error. Reported-by: [email protected] Fixes: 4ab42d7 ("ppp, slip: Validate VJ compression slot parameters completely") Acked-by: Ben Hutchings <[email protected]> Cc: David Miller <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ce94493 commit baf76f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/slip/slhc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ slhc_init(int rslots, int tslots)
153153
void
154154
slhc_free(struct slcompress *comp)
155155
{
156-
if ( comp == NULLSLCOMPR )
156+
if ( IS_ERR_OR_NULL(comp) )
157157
return;
158158

159159
if ( comp->tstate != NULLSLSTATE )

0 commit comments

Comments
 (0)