mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-09-18 22:14:16 +00:00 
			
		
		
		
	[NETFILTER]: nf_conntrack_amanda: fix textsearch_prepare() error check
The return value from textsearch_prepare() needs to be checked by IS_ERR(). Because it returns error code as a pointer. Cc: "Brian J. Murrell" <netfilter@interlinx.bc.ca> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									4c1b52bc7a
								
							
						
					
					
						commit
						c764c9ade6
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		|  | @ -208,14 +208,15 @@ static int __init nf_conntrack_amanda_init(void) | |||
| { | ||||
| 	int ret, i; | ||||
| 
 | ||||
| 	ret = -ENOMEM; | ||||
| 	for (i = 0; i < ARRAY_SIZE(search); i++) { | ||||
| 		search[i].ts = textsearch_prepare(ts_algo, search[i].string, | ||||
| 						  search[i].len, | ||||
| 						  GFP_KERNEL, TS_AUTOLOAD); | ||||
| 		if (search[i].ts == NULL) | ||||
| 		if (IS_ERR(search[i].ts)) { | ||||
| 			ret = PTR_ERR(search[i].ts); | ||||
| 			goto err1; | ||||
| 		} | ||||
| 	} | ||||
| 	ret = nf_conntrack_helper_register(&amanda_helper[0]); | ||||
| 	if (ret < 0) | ||||
| 		goto err1; | ||||
|  | @ -227,10 +228,9 @@ static int __init nf_conntrack_amanda_init(void) | |||
| err2: | ||||
| 	nf_conntrack_helper_unregister(&amanda_helper[0]); | ||||
| err1: | ||||
| 	for (; i >= 0; i--) { | ||||
| 		if (search[i].ts) | ||||
| 	while (--i >= 0) | ||||
| 		textsearch_destroy(search[i].ts); | ||||
| 	} | ||||
| 
 | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Akinobu Mita
						Akinobu Mita