Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\apparmor\policy_unpack.c Create Date:2022-07-28 19:52:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:deflate_compress

Proto:static int deflate_compress(const char *src, size_t slen, char **dst, size_t *dlen)

Type:int

Parameter:

TypeParameterName
const char *src
size_tslen
char **dst
size_t *dlen
1054  stglen = This function is equivalent to deflateEnd followed by deflateInit,but does not free and reallocate all the internal compression state
1056  memset( & strm, 0, size of strm )
1058  If stglen < slen Then Return -EFBIG
1061  memory allocated for this stream = kvzalloc(zlib_deflate_workspacesize(32K LZ77 window , Maximum value for memLevel in deflateInit2 ), GFP_KERNEL)
1064  If Not memory allocated for this stream Then Return -ENOMEM
1067  error = This function adds the data at next_in (avail_in bytes) to the outputhistory without performing any output( & strm, aa_g_rawdata_compression_level)
1068  If error != Allowed flush values; see deflate() and inflate() below for details Then
1069  error = -ENOMEM
1070  Go to fail_deflate_init
1073  stgbuf = kvzalloc(stglen, GFP_KERNEL)
1074  If Not stgbuf Then
1075  error = -ENOMEM
1076  Go to fail_stg_alloc
1079  next input byte = src
1080  number of bytes available at next_in = slen
1081  next output byte should be put there = stgbuf
1082  remaining free space at next_out = stglen
1084  error = zlib_deflate( & strm, Z_FINISH)
1085  If error != Z_STREAM_END Then
1086  error = -EINVAL
1087  Go to fail_deflate
1089  error = 0
1091  If Determine if an address is within the vmalloc range* On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there* is no special casing required. Then
1092  dstbuf = kvzalloc( total nb of bytes output so far , GFP_KERNEL)
1093  If dstbuf Then
1097  Else dstbuf = krealloc - reallocate memory. The contents will remain unchanged.*@p: object to reallocate memory for.*@new_size: how many bytes of memory are required.*@flags: the type of memory to allocate.* The contents of the object pointed to are preserved up to the
1105  If Not dstbuf Then
1106  error = -ENOMEM
1107  Go to fail_deflate
1110  dst = dstbuf
1111  dlen = total nb of bytes output so far
1113  fail_stg_alloc :
1114  zlib_deflateEnd( & strm)
1115  fail_deflate_init :
1116  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
1117  Return error
1119  fail_deflate :
1120  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
1121  Go to fail_stg_alloc
Caller
NameDescribe
compress_loaddata