idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
35,900 | local unsigned long gf2_matrix_times(unsigned long *mat, unsigned long vec)
{
unsigned long sum;
sum = 0;
while (vec) {
if (vec & 1)
sum ^= *mat;
vec >>= 1;
mat++;
}
return sum;
}
| Dir. Trav. | 0 | local unsigned long gf2_matrix_times(unsigned long *mat, unsigned long vec)
{
unsigned long sum;
sum = 0;
while (vec) {
if (vec & 1)
sum ^= *mat;
vec >>= 1;
mat++;
}
return sum;
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,901 | local size_t grow(size_t size)
{
size_t was, top;
int shift;
was = size;
size += size >> 2;
top = size;
for (shift = 0; top > 7; shift++)
top >>= 1;
if (top == 7)
size = (size_t)1 << (shift + 3);
if (size < 16)
size = 16;
if (size <= was)
size = (size... | Dir. Trav. | 0 | local size_t grow(size_t size)
{
size_t was, top;
int shift;
was = size;
size += size >> 2;
top = size;
for (shift = 0; top > 7; shift++)
top >>= 1;
if (top == 7)
size = (size_t)1 << (shift + 3);
if (size < 16)
size = 16;
if (size <= was)
size = (size... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,902 | local void grow_space(struct space *space)
{
size_t more;
/* compute next size up */
more = grow(space->size);
if (more == space->size)
bail("not enough memory", "");
/* reallocate the buffer */
space->buf = REALLOC(space->buf, more);
if (space->buf == NULL)
bail("not enoug... | Dir. Trav. | 0 | local void grow_space(struct space *space)
{
size_t more;
/* compute next size up */
more = grow(space->size);
if (more == space->size)
bail("not enough memory", "");
/* reallocate the buffer */
space->buf = REALLOC(space->buf, more);
if (space->buf == NULL)
bail("not enoug... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,903 | local void help(void)
{
int n;
if (g.verbosity == 0)
return;
for (n = 0; n < (int)(sizeof(helptext) / sizeof(char *)); n++)
fprintf(stderr, "%s\n", helptext[n]);
fflush(stderr);
exit(0);
}
| Dir. Trav. | 0 | local void help(void)
{
int n;
if (g.verbosity == 0)
return;
for (n = 0; n < (int)(sizeof(helptext) / sizeof(char *)); n++)
fprintf(stderr, "%s\n", helptext[n]);
fflush(stderr);
exit(0);
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,904 | local void in_init(void)
{
g.in_left = 0;
g.in_eof = 0;
g.in_short = 0;
g.in_tot = 0;
#ifndef NOTHREAD
g.in_which = -1;
#endif
}
| Dir. Trav. | 0 | local void in_init(void)
{
g.in_left = 0;
g.in_eof = 0;
g.in_short = 0;
g.in_tot = 0;
#ifndef NOTHREAD
g.in_which = -1;
#endif
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,905 | local unsigned inb(void *desc, unsigned char **buf)
{
(void)desc;
load();
*buf = g.in_next;
return g.in_left;
}
| Dir. Trav. | 0 | local unsigned inb(void *desc, unsigned char **buf)
{
(void)desc;
load();
*buf = g.in_next;
return g.in_left;
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,906 | local void infchk(void)
{
int ret, cont, was;
unsigned long check, len;
z_stream strm;
unsigned tmp2;
unsigned long tmp4;
off_t clen;
cont = 0;
do {
/* header already read -- set up for decompression */
g.in_tot = g.in_left; /* track compressed data length */
... | Dir. Trav. | 0 | local void infchk(void)
{
int ret, cont, was;
unsigned long check, len;
z_stream strm;
unsigned tmp2;
unsigned long tmp4;
off_t clen;
cont = 0;
do {
/* header already read -- set up for decompression */
g.in_tot = g.in_left; /* track compressed data length */
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,907 | local char *justname(char *path)
{
char *p;
p = strrchr(path, '/');
return p == NULL ? path : p + 1;
}
| Dir. Trav. | 0 | local char *justname(char *path)
{
char *p;
p = strrchr(path, '/');
return p == NULL ? path : p + 1;
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,908 | local void list_info(void)
{
int method; /* get_header() return value */
size_t n; /* available trailer bytes */
off_t at; /* used to calculate compressed length */
unsigned char tail[8]; /* trailer containing check and length */
unsigned long check, len; /... | Dir. Trav. | 0 | local void list_info(void)
{
int method; /* get_header() return value */
size_t n; /* available trailer bytes */
off_t at; /* used to calculate compressed length */
unsigned char tail[8]; /* trailer containing check and length */
unsigned long check, len; /... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,909 | local size_t load(void)
{
/* if already detected end of file, do nothing */
if (g.in_short) {
g.in_eof = 1;
g.in_left = 0;
return 0;
}
#ifndef NOTHREAD
/* if first time in or procs == 1, read a buffer to have something to
return, otherwise wait for the previous read job t... | Dir. Trav. | 0 | local size_t load(void)
{
/* if already detected end of file, do nothing */
if (g.in_short) {
g.in_eof = 1;
g.in_left = 0;
return 0;
}
#ifndef NOTHREAD
/* if first time in or procs == 1, read a buffer to have something to
return, otherwise wait for the previous read job t... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,910 | local void load_read(void *dummy)
{
size_t len;
(void)dummy;
Trace(("-- launched decompress read thread"));
do {
possess(g.load_state);
wait_for(g.load_state, TO_BE, 1);
g.in_len = len = readn(g.ind, g.in_which ? g.in_buf : g.in_buf2, BUF);
Trace(("-- decompress read th... | Dir. Trav. | 0 | local void load_read(void *dummy)
{
size_t len;
(void)dummy;
Trace(("-- launched decompress read thread"));
do {
possess(g.load_state);
wait_for(g.load_state, TO_BE, 1);
g.in_len = len = readn(g.ind, g.in_which ? g.in_buf : g.in_buf2, BUF);
Trace(("-- decompress read th... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,911 | local void log_add(char *fmt, ...)
{
struct timeval now;
struct log *me;
va_list ap;
char msg[MAXMSG];
gettimeofday(&now, NULL);
me = MALLOC(sizeof(struct log));
if (me == NULL)
bail("not enough memory", "");
me->when = now;
va_start(ap, fmt);
vsnprintf(msg, MAXMSG, fmt,... | Dir. Trav. | 0 | local void log_add(char *fmt, ...)
{
struct timeval now;
struct log *me;
va_list ap;
char msg[MAXMSG];
gettimeofday(&now, NULL);
me = MALLOC(sizeof(struct log));
if (me == NULL)
bail("not enough memory", "");
me->when = now;
va_start(ap, fmt);
vsnprintf(msg, MAXMSG, fmt,... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,912 | local void log_dump(void)
{
if (log_tail == NULL)
return;
while (log_show())
;
log_free();
if (mem_track.num || mem_track.size)
complain("memory leak: %lu allocs of %lu bytes total",
mem_track.num, mem_track.size);
if (mem_track.max)
fprintf(stderr, "... | Dir. Trav. | 0 | local void log_dump(void)
{
if (log_tail == NULL)
return;
while (log_show())
;
log_free();
if (mem_track.num || mem_track.size)
complain("memory leak: %lu allocs of %lu bytes total",
mem_track.num, mem_track.size);
if (mem_track.max)
fprintf(stderr, "... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,913 | local void log_free(void)
{
struct log *me;
if (log_tail != NULL) {
#ifndef NOTHREAD
possess(log_lock);
#endif
while ((me = log_head) != NULL) {
log_head = me->next;
FREE(me->msg);
FREE(me);
}
#ifndef NOTHREAD
twist(log_lock, TO, 0);
f... | Dir. Trav. | 0 | local void log_free(void)
{
struct log *me;
if (log_tail != NULL) {
#ifndef NOTHREAD
possess(log_lock);
#endif
while ((me = log_head) != NULL) {
log_head = me->next;
FREE(me->msg);
FREE(me);
}
#ifndef NOTHREAD
twist(log_lock, TO, 0);
f... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,914 | local void log_init(void)
{
if (log_tail == NULL) {
mem_track.num = 0;
mem_track.size = 0;
mem_track.max = 0;
#ifndef NOTHREAD
mem_track.lock = new_lock(0);
yarn_mem(yarn_malloc, yarn_free);
log_lock = new_lock(0);
#endif
log_head = NULL;
log_tail = &l... | Dir. Trav. | 0 | local void log_init(void)
{
if (log_tail == NULL) {
mem_track.num = 0;
mem_track.size = 0;
mem_track.max = 0;
#ifndef NOTHREAD
mem_track.lock = new_lock(0);
yarn_mem(yarn_malloc, yarn_free);
log_lock = new_lock(0);
#endif
log_head = NULL;
log_tail = &l... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,915 | int main(int argc, char **argv)
{
int n; /* general index */
int noop; /* true to suppress option decoding */
unsigned long done; /* number of named files processed */
char *opts, *p; /* environment default options, marker */
... | Dir. Trav. | 0 | int main(int argc, char **argv)
{
int n; /* general index */
int noop; /* true to suppress option decoding */
unsigned long done; /* number of named files processed */
char *opts, *p; /* environment default options, marker */
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,916 | local void new_pool(struct pool *pool, size_t size, int limit)
{
pool->have = new_lock(0);
pool->head = NULL;
pool->size = size;
pool->limit = limit;
pool->made = 0;
}
| Dir. Trav. | 0 | local void new_pool(struct pool *pool, size_t size, int limit)
{
pool->have = new_lock(0);
pool->head = NULL;
pool->size = size;
pool->limit = limit;
pool->made = 0;
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,917 | local size_t num(char *arg)
{
char *str = arg;
size_t val = 0;
if (*str == 0)
bail("internal error: empty parameter", "");
do {
if (*str < '0' || *str > '9' ||
(val && ((~(size_t)0) - (*str - '0')) / val < 10))
bail("invalid numeric parameter: ", arg);
va... | Dir. Trav. | 0 | local size_t num(char *arg)
{
char *str = arg;
size_t val = 0;
if (*str == 0)
bail("internal error: empty parameter", "");
do {
if (*str < '0' || *str > '9' ||
(val && ((~(size_t)0) - (*str - '0')) / val < 10))
bail("invalid numeric parameter: ", arg);
va... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,918 | local int option(char *arg)
{
static int get = 0; /* if not zero, look for option parameter */
char bad[3] = "-X"; /* for error messages (X is replaced) */
/* if no argument or dash option, check status of get */
if (get && (arg == NULL || *arg == '-')) {
bad[1] = "bpSIM"[get - 1];
... | Dir. Trav. | 0 | local int option(char *arg)
{
static int get = 0; /* if not zero, look for option parameter */
char bad[3] = "-X"; /* for error messages (X is replaced) */
/* if no argument or dash option, check status of get */
if (get && (arg == NULL || *arg == '-')) {
bad[1] = "bpSIM"[get - 1];
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,919 | local int outb(void *desc, unsigned char *buf, unsigned len)
{
#ifndef NOTHREAD
static thread *wr, *ch;
if (g.procs > 1) {
/* if first time, initialize state and launch threads */
if (outb_write_more == NULL) {
outb_write_more = new_lock(0);
outb_check_more = new_lock(0)... | Dir. Trav. | 0 | local int outb(void *desc, unsigned char *buf, unsigned len)
{
#ifndef NOTHREAD
static thread *wr, *ch;
if (g.procs > 1) {
/* if first time, initialize state and launch threads */
if (outb_write_more == NULL) {
outb_write_more = new_lock(0);
outb_check_more = new_lock(0)... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,920 | local void outb_write(void *dummy)
{
size_t len;
(void)dummy;
Trace(("-- launched decompress write thread"));
do {
possess(outb_write_more);
wait_for(outb_write_more, TO_BE, 1);
len = out_len;
if (len && g.decode == 1)
writen(g.outd, out_copy, len);
... | Dir. Trav. | 0 | local void outb_write(void *dummy)
{
size_t len;
(void)dummy;
Trace(("-- launched decompress write thread"));
do {
possess(outb_write_more);
wait_for(outb_write_more, TO_BE, 1);
len = out_len;
if (len && g.decode == 1)
writen(g.outd, out_copy, len);
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,921 | local void parallel_compress(void)
{
long seq; /* sequence number */
struct space *curr; /* input data to compress */
struct space *next; /* input data that follows curr */
struct space *hold; /* input data that follows next */
struct space *... | Dir. Trav. | 0 | local void parallel_compress(void)
{
long seq; /* sequence number */
struct space *curr; /* input data to compress */
struct space *next; /* input data that follows curr */
struct space *hold; /* input data that follows next */
struct space *... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,922 | local unsigned long put_header(void)
{
unsigned long len;
unsigned char head[30];
if (g.form > 1) { /* zip */
/* write local header */
PUT4L(head, 0x04034b50UL); /* local header signature */
PUT2L(head + 4, 20); /* version needed to extract (2.0) */
PUT... | Dir. Trav. | 0 | local unsigned long put_header(void)
{
unsigned long len;
unsigned char head[30];
if (g.form > 1) { /* zip */
/* write local header */
PUT4L(head, 0x04034b50UL); /* local header signature */
PUT2L(head + 4, 20); /* version needed to extract (2.0) */
PUT... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,923 | local void put_trailer(unsigned long ulen, unsigned long clen,
unsigned long check, unsigned long head)
{
unsigned char tail[46];
if (g.form > 1) { /* zip */
unsigned long cent;
/* write data descriptor (as promised in local header) */
PUT4L(tail, 0... | Dir. Trav. | 0 | local void put_trailer(unsigned long ulen, unsigned long clen,
unsigned long check, unsigned long head)
{
unsigned char tail[46];
if (g.form > 1) { /* zip */
unsigned long cent;
/* write data descriptor (as promised in local header) */
PUT4L(tail, 0... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,924 | local size_t readn(int desc, unsigned char *buf, size_t len)
{
ssize_t ret;
size_t got;
got = 0;
while (len) {
ret = read(desc, buf, len);
if (ret < 0)
bail("read error on ", g.inf);
if (ret == 0)
break;
buf += ret;
len -= ret;
got... | Dir. Trav. | 0 | local size_t readn(int desc, unsigned char *buf, size_t len)
{
ssize_t ret;
size_t got;
got = 0;
while (len) {
ret = read(desc, buf, len);
if (ret < 0)
bail("read error on ", g.inf);
if (ret == 0)
break;
buf += ret;
len -= ret;
got... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,925 | local void *realloc_track(struct mem_track_s *mem, void *ptr, size_t size)
{
size_t was;
if (ptr == NULL)
return malloc_track(mem, size);
was = MALLOC_SIZE(ptr);
ptr = realloc(ptr, size);
if (ptr != NULL) {
size = MALLOC_SIZE(ptr);
mem_track_grab(mem);
mem->size -= w... | Dir. Trav. | 0 | local void *realloc_track(struct mem_track_s *mem, void *ptr, size_t size)
{
size_t was;
if (ptr == NULL)
return malloc_track(mem, size);
was = MALLOC_SIZE(ptr);
ptr = realloc(ptr, size);
if (ptr != NULL) {
size = MALLOC_SIZE(ptr);
mem_track_grab(mem);
mem->size -= w... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,926 | local void setup_jobs(void)
{
/* set up only if not already set up*/
if (compress_have != NULL)
return;
/* allocate locks and initialize lists */
compress_have = new_lock(0);
compress_head = NULL;
compress_tail = &compress_head;
write_first = new_lock(-1);
write_head = NULL;
... | Dir. Trav. | 0 | local void setup_jobs(void)
{
/* set up only if not already set up*/
if (compress_have != NULL)
return;
/* allocate locks and initialize lists */
compress_have = new_lock(0);
compress_head = NULL;
compress_tail = &compress_head;
write_first = new_lock(-1);
write_head = NULL;
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,927 | local void show_info(int method, unsigned long check, off_t len, int cont)
{
size_t max; /* maximum name length for current verbosity */
size_t n; /* name length without suffix */
time_t now; /* for getting current year */
char mod[26]; /* modification tim... | Dir. Trav. | 0 | local void show_info(int method, unsigned long check, off_t len, int cont)
{
size_t max; /* maximum name length for current verbosity */
size_t n; /* name length without suffix */
time_t now; /* for getting current year */
char mod[26]; /* modification tim... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,928 | local void single_compress(int reset)
{
size_t got; /* amount of data in in[] */
size_t more; /* amount of data in next[] (0 if eof) */
size_t start; /* start of data in next[] */
size_t have; /* bytes in current block for -i */... | Dir. Trav. | 0 | local void single_compress(int reset)
{
size_t got; /* amount of data in in[] */
size_t more; /* amount of data in next[] (0 if eof) */
size_t start; /* start of data in next[] */
size_t have; /* bytes in current block for -i */... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,929 | local unsigned long time2dos(time_t t)
{
struct tm *tm;
unsigned long dos;
if (t == 0)
t = time(NULL);
tm = localtime(&t);
if (tm->tm_year < 80 || tm->tm_year > 207)
return 0;
dos = (tm->tm_year - 80) << 25;
dos += (tm->tm_mon + 1) << 21;
dos += tm->tm_mday << 16;
do... | Dir. Trav. | 0 | local unsigned long time2dos(time_t t)
{
struct tm *tm;
unsigned long dos;
if (t == 0)
t = time(NULL);
tm = localtime(&t);
if (tm->tm_year < 80 || tm->tm_year > 207)
return 0;
dos = (tm->tm_year - 80) << 25;
dos += (tm->tm_mon + 1) << 21;
dos += tm->tm_mday << 16;
do... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,930 | local void touch(char *path, time_t t)
{
struct timeval times[2];
times[0].tv_sec = t;
times[0].tv_usec = 0;
times[1].tv_sec = t;
times[1].tv_usec = 0;
(void)utimes(path, times);
}
| Dir. Trav. | 0 | local void touch(char *path, time_t t)
{
struct timeval times[2];
times[0].tv_sec = t;
times[0].tv_usec = 0;
times[1].tv_sec = t;
times[1].tv_usec = 0;
(void)utimes(path, times);
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,931 | local void unlzw(void)
{
unsigned bits; /* current bits per code (9..16) */
unsigned mask; /* mask for current bits codes = (1<<bits)-1 */
bits_t buf; /* bit buffer (need 23 bits) */
unsigned left; /* bits left in buf (0..7 after code pulled) */
... | Dir. Trav. | 0 | local void unlzw(void)
{
unsigned bits; /* current bits per code (9..16) */
unsigned mask; /* mask for current bits codes = (1<<bits)-1 */
bits_t buf; /* bit buffer (need 23 bits) */
unsigned left; /* bits left in buf (0..7 after code pulled) */
... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,932 | local void use_space(struct space *space)
{
possess(space->use);
twist(space->use, BY, +1);
}
| Dir. Trav. | 0 | local void use_space(struct space *space)
{
possess(space->use);
twist(space->use, BY, +1);
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,933 | local void write_thread(void *dummy)
{
long seq; /* next sequence number looking for */
struct job *job; /* job pulled and working on */
size_t len; /* input length */
int more; /* true if more chunks to write */
unsigned... | Dir. Trav. | 0 | local void write_thread(void *dummy)
{
long seq; /* next sequence number looking for */
struct job *job; /* job pulled and working on */
size_t len; /* input length */
int more; /* true if more chunks to write */
unsigned... | @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,934 | local void writen(int desc, unsigned char *buf, size_t len)
{
ssize_t ret;
while (len) {
ret = write(desc, buf, len);
if (ret < 1) {
complain("write error code %d", errno);
bail("write error on ", g.outf);
}
buf += ret;
len -= ret;
}
}
| Dir. Trav. | 0 | local void writen(int desc, unsigned char *buf, size_t len)
{
ssize_t ret;
while (len) {
ret = write(desc, buf, len);
if (ret < 1) {
complain("write error code %d", errno);
bail("write error on ", g.outf);
}
buf += ret;
len -= ret;
}
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,935 | local void yarn_free(void *ptr)
{
return free_track(&mem_track, ptr);
}
| Dir. Trav. | 0 | local void yarn_free(void *ptr)
{
return free_track(&mem_track, ptr);
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,936 | local void *yarn_malloc(size_t size)
{
return malloc_track(&mem_track, size);
}
| Dir. Trav. | 0 | local void *yarn_malloc(size_t size)
{
return malloc_track(&mem_track, size);
}
| @@ -3520,26 +3520,35 @@ local void process(char *path)
" (use -f to force)");
}
else {
- char *to, *repl;
-
- /* use header name for output when decompressing with -N */
- to = g.inf;
- if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {
- to = g.... | CWE-22 | null | null |
35,937 | static void uv__chld(uv_signal_t* handle, int signum) {
uv_process_t* process;
uv_loop_t* loop;
int exit_status;
int term_signal;
unsigned int i;
int status;
pid_t pid;
QUEUE pending;
QUEUE* h;
QUEUE* q;
assert(signum == SIGCHLD);
QUEUE_INIT(&pending);
loop = handle->loop;
for (i = 0; i <... | +Priv | 0 | static void uv__chld(uv_signal_t* handle, int signum) {
uv_process_t* process;
uv_loop_t* loop;
int exit_status;
int term_signal;
unsigned int i;
int status;
pid_t pid;
QUEUE pending;
QUEUE* h;
QUEUE* q;
assert(signum == SIGCHLD);
QUEUE_INIT(&pending);
loop = handle->loop;
for (i = 0; i <... | @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,938 | int uv__make_pipe(int fds[2], int flags) {
#if defined(__linux__)
static int no_pipe2;
if (no_pipe2)
goto skip;
if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0)
return 0;
if (errno != ENOSYS)
return -errno;
no_pipe2 = 1;
skip:
#endif
if (pipe(fds))
return -errno;
uv__cloexec(fds[0], ... | +Priv | 0 | int uv__make_pipe(int fds[2], int flags) {
#if defined(__linux__)
static int no_pipe2;
if (no_pipe2)
goto skip;
if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0)
return 0;
if (errno != ENOSYS)
return -errno;
no_pipe2 = 1;
skip:
#endif
if (pipe(fds))
return -errno;
uv__cloexec(fds[0], ... | @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,939 | int uv__make_socketpair(int fds[2], int flags) {
#if defined(__linux__)
static int no_cloexec;
if (no_cloexec)
goto skip;
if (socketpair(AF_UNIX, SOCK_STREAM | UV__SOCK_CLOEXEC | flags, 0, fds) == 0)
return 0;
/* Retry on EINVAL, it means SOCK_CLOEXEC is not supported.
* Anything else is a genuine... | +Priv | 0 | int uv__make_socketpair(int fds[2], int flags) {
#if defined(__linux__)
static int no_cloexec;
if (no_cloexec)
goto skip;
if (socketpair(AF_UNIX, SOCK_STREAM | UV__SOCK_CLOEXEC | flags, 0, fds) == 0)
return 0;
/* Retry on EINVAL, it means SOCK_CLOEXEC is not supported.
* Anything else is a genuine... | @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,940 | static void uv__process_close_stream(uv_stdio_container_t* container) {
if (!(container->flags & UV_CREATE_PIPE)) return;
uv__stream_close((uv_stream_t*)container->data.stream);
}
| +Priv | 0 | static void uv__process_close_stream(uv_stdio_container_t* container) {
if (!(container->flags & UV_CREATE_PIPE)) return;
uv__stream_close((uv_stream_t*)container->data.stream);
}
| @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,941 | static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
int mask;
int fd;
mask = UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | UV_INHERIT_STREAM;
switch (container->flags & mask) {
case UV_IGNORE:
return 0;
case UV_CREATE_PIPE:
assert(container->data.stream != NULL);
i... | +Priv | 0 | static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
int mask;
int fd;
mask = UV_IGNORE | UV_CREATE_PIPE | UV_INHERIT_FD | UV_INHERIT_STREAM;
switch (container->flags & mask) {
case UV_IGNORE:
return 0;
case UV_CREATE_PIPE:
assert(container->data.stream != NULL);
i... | @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,942 | static int uv__process_open_stream(uv_stdio_container_t* container,
int pipefds[2],
int writable) {
int flags;
if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0)
return 0;
if (uv__close(pipefds[1]))
if (errno != EINTR && errn... | +Priv | 0 | static int uv__process_open_stream(uv_stdio_container_t* container,
int pipefds[2],
int writable) {
int flags;
if (!(container->flags & UV_CREATE_PIPE) || pipefds[0] < 0)
return 0;
if (uv__close(pipefds[1]))
if (errno != EINTR && errn... | @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,943 | static QUEUE* uv__process_queue(uv_loop_t* loop, int pid) {
assert(pid > 0);
return loop->process_handles + pid % ARRAY_SIZE(loop->process_handles);
}
| +Priv | 0 | static QUEUE* uv__process_queue(uv_loop_t* loop, int pid) {
assert(pid > 0);
return loop->process_handles + pid % ARRAY_SIZE(loop->process_handles);
}
| @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,944 | static void uv__write_int(int fd, int val) {
ssize_t n;
do
n = write(fd, &val, sizeof(val));
while (n == -1 && errno == EINTR);
if (n == -1 && errno == EPIPE)
return; /* parent process has quit */
assert(n == sizeof(val));
}
| +Priv | 0 | static void uv__write_int(int fd, int val) {
ssize_t n;
do
n = write(fd, &val, sizeof(val));
while (n == -1 && errno == EINTR);
if (n == -1 && errno == EPIPE)
return; /* parent process has quit */
assert(n == sizeof(val));
}
| @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,945 | int uv_kill(int pid, int signum) {
if (kill(pid, signum))
return -errno;
else
return 0;
}
| +Priv | 0 | int uv_kill(int pid, int signum) {
if (kill(pid, signum))
return -errno;
else
return 0;
}
| @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,946 | int uv_spawn(uv_loop_t* loop,
uv_process_t* process,
const uv_process_options_t* options) {
int signal_pipe[2] = { -1, -1 };
int (*pipes)[2];
int stdio_count;
QUEUE* q;
ssize_t r;
pid_t pid;
int err;
int exec_errorno;
int i;
assert(options->file != NULL);
assert(!(option... | +Priv | 0 | int uv_spawn(uv_loop_t* loop,
uv_process_t* process,
const uv_process_options_t* options) {
int signal_pipe[2] = { -1, -1 };
int (*pipes)[2];
int stdio_count;
QUEUE* q;
ssize_t r;
pid_t pid;
int err;
int exec_errorno;
int i;
assert(options->file != NULL);
assert(!(option... | @@ -330,6 +330,17 @@ static void uv__process_child_init(const uv_process_options_t* options,
_exit(127);
}
+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
... | CWE-264 | null | null |
35,947 | static int __ext4_ext_check(const char *function, unsigned int line,
struct inode *inode, struct ext4_extent_header *eh,
int depth, ext4_fsblk_t pblk)
{
const char *error_msg;
int max = 0;
if (unlikely(eh->eh_magic != EXT4_EXT_MAGIC)) {
error_msg = "invalid magic";
goto corrupted;
}
if (unlikely... | DoS | 0 | static int __ext4_ext_check(const char *function, unsigned int line,
struct inode *inode, struct ext4_extent_header *eh,
int depth, ext4_fsblk_t pblk)
{
const char *error_msg;
int max = 0;
if (unlikely(eh->eh_magic != EXT4_EXT_MAGIC)) {
error_msg = "invalid magic";
goto corrupted;
}
if (unlikely... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,948 | __read_extent_tree_block(const char *function, unsigned int line,
struct inode *inode, ext4_fsblk_t pblk, int depth,
int flags)
{
struct buffer_head *bh;
int err;
bh = sb_getblk(inode->i_sb, pblk);
if (unlikely(!bh))
return ERR_PTR(-ENOMEM);
if (!bh_uptodate_or_lock(bh)) {
trace_ext4_ext_load_ext... | DoS | 0 | __read_extent_tree_block(const char *function, unsigned int line,
struct inode *inode, ext4_fsblk_t pblk, int depth,
int flags)
{
struct buffer_head *bh;
int err;
bh = sb_getblk(inode->i_sb, pblk);
if (unlikely(!bh))
return ERR_PTR(-ENOMEM);
if (!bh_uptodate_or_lock(bh)) {
trace_ext4_ext_load_ext... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,949 | convert_initialized_extent(handle_t *handle, struct inode *inode,
struct ext4_map_blocks *map,
struct ext4_ext_path **ppath, int flags,
unsigned int allocated, ext4_fsblk_t newblock)
{
struct ext4_ext_path *path = *ppath;
struct ext4_extent *ex;
ext4_lblk_t ee_block;
unsigned int ee_len;
int dept... | DoS | 0 | convert_initialized_extent(handle_t *handle, struct inode *inode,
struct ext4_map_blocks *map,
struct ext4_ext_path **ppath, int flags,
unsigned int allocated, ext4_fsblk_t newblock)
{
struct ext4_ext_path *path = *ppath;
struct ext4_extent *ex;
ext4_lblk_t ee_block;
unsigned int ee_len;
int dept... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,950 | ext4_access_path(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path)
{
int credits, err;
if (!ext4_handle_valid(handle))
return 0;
/*
* Check if need to extend journal credits
* 3 for leaf, sb, and inode plus 2 (bmap and group
* descriptor) for each block group; assume two block
* groups... | DoS | 0 | ext4_access_path(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path)
{
int credits, err;
if (!ext4_handle_valid(handle))
return 0;
/*
* Check if need to extend journal credits
* 3 for leaf, sb, and inode plus 2 (bmap and group
* descriptor) for each block group; assume two block
* groups... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,951 | int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
{
struct super_block *sb = inode->i_sb;
ext4_lblk_t punch_start, punch_stop;
handle_t *handle;
unsigned int credits;
loff_t new_size, ioffset;
int ret;
/* Collapse range works only on fs block size aligned offsets. */
if (offset & (EXT4_CL... | DoS | 0 | int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
{
struct super_block *sb = inode->i_sb;
ext4_lblk_t punch_start, punch_stop;
handle_t *handle;
unsigned int credits;
loff_t new_size, ioffset;
int ret;
/* Collapse range works only on fs block size aligned offsets. */
if (offset & (EXT4_CL... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,952 | int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode,
loff_t offset, ssize_t len)
{
unsigned int max_blocks;
int ret = 0;
int ret2 = 0;
struct ext4_map_blocks map;
unsigned int credits, blkbits = inode->i_blkbits;
map.m_lblk = offset >> blkbits;
/*
* We can't just convert len to max... | DoS | 0 | int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode,
loff_t offset, ssize_t len)
{
unsigned int max_blocks;
int ret = 0;
int ret2 = 0;
struct ext4_map_blocks map;
unsigned int credits, blkbits = inode->i_blkbits;
map.m_lblk = offset >> blkbits;
/*
* We can't just convert len to max... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,953 | static int ext4_convert_unwritten_extents_endio(handle_t *handle,
struct inode *inode,
struct ext4_map_blocks *map,
struct ext4_ext_path **ppath)
{
struct ext4_ext_path *path = *ppath;
struct ext4_extent *ex;
ext4_lblk_t ee_block;
unsigned int ee_len;
int depth;
int err = 0;
depth = ext_depth(... | DoS | 0 | static int ext4_convert_unwritten_extents_endio(handle_t *handle,
struct inode *inode,
struct ext4_map_blocks *map,
struct ext4_ext_path **ppath)
{
struct ext4_ext_path *path = *ppath;
struct ext4_extent *ex;
ext4_lblk_t ee_block;
unsigned int ee_len;
int depth;
int err = 0;
depth = ext_depth(... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,954 | ext4_ext_binsearch(struct inode *inode,
struct ext4_ext_path *path, ext4_lblk_t block)
{
struct ext4_extent_header *eh = path->p_hdr;
struct ext4_extent *r, *l, *m;
if (eh->eh_entries == 0) {
/*
* this leaf is empty:
* we get such a leaf in split/add case
*/
return;
}
ext_debug("binsearch for %u: ... | DoS | 0 | ext4_ext_binsearch(struct inode *inode,
struct ext4_ext_path *path, ext4_lblk_t block)
{
struct ext4_extent_header *eh = path->p_hdr;
struct ext4_extent *r, *l, *m;
if (eh->eh_entries == 0) {
/*
* this leaf is empty:
* we get such a leaf in split/add case
*/
return;
}
ext_debug("binsearch for %u: ... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,955 | static unsigned int ext4_ext_check_overlap(struct ext4_sb_info *sbi,
struct inode *inode,
struct ext4_extent *newext,
struct ext4_ext_path *path)
{
ext4_lblk_t b1, b2;
unsigned int depth, len1;
unsigned int ret = 0;
b1 = le32_to_cpu(newext->ee_block);
len1 = ext4_ext_get_actual_len(newext)... | DoS | 0 | static unsigned int ext4_ext_check_overlap(struct ext4_sb_info *sbi,
struct inode *inode,
struct ext4_extent *newext,
struct ext4_ext_path *path)
{
ext4_lblk_t b1, b2;
unsigned int depth, len1;
unsigned int ret = 0;
b1 = le32_to_cpu(newext->ee_block);
len1 = ext4_ext_get_actual_len(newext)... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,956 | static int ext4_ext_convert_to_initialized(handle_t *handle,
struct inode *inode,
struct ext4_map_blocks *map,
struct ext4_ext_path **ppath,
int flags)
{
struct ext4_ext_path *path = *ppath;
struct ext4_sb_info *sbi;
struct ext4_extent_header *eh;
struct ext4_map_blocks split_map;
s... | DoS | 0 | static int ext4_ext_convert_to_initialized(handle_t *handle,
struct inode *inode,
struct ext4_map_blocks *map,
struct ext4_ext_path **ppath,
int flags)
{
struct ext4_ext_path *path = *ppath;
struct ext4_sb_info *sbi;
struct ext4_extent_header *eh;
struct ext4_map_blocks split_map;
s... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,957 | static int ext4_ext_create_new_leaf(handle_t *handle, struct inode *inode,
unsigned int mb_flags,
unsigned int gb_flags,
struct ext4_ext_path **ppath,
struct ext4_extent *newext)
{
struct ext4_ext_path *path = *ppath;
struct ext4_ext_path *curp;
int depth, i, err = 0;
repeat:
i = de... | DoS | 0 | static int ext4_ext_create_new_leaf(handle_t *handle, struct inode *inode,
unsigned int mb_flags,
unsigned int gb_flags,
struct ext4_ext_path **ppath,
struct ext4_extent *newext)
{
struct ext4_ext_path *path = *ppath;
struct ext4_ext_path *curp;
int depth, i, err = 0;
repeat:
i = de... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,958 | static int ext4_ext_get_access(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path)
{
if (path->p_bh) {
/* path points to block */
BUFFER_TRACE(path->p_bh, "get_write_access");
return ext4_journal_get_write_access(handle, path->p_bh);
}
/* path points to leaf/index in inode body */
/* we use... | DoS | 0 | static int ext4_ext_get_access(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path)
{
if (path->p_bh) {
/* path points to block */
BUFFER_TRACE(path->p_bh, "get_write_access");
return ext4_journal_get_write_access(handle, path->p_bh);
}
/* path points to leaf/index in inode body */
/* we use... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,959 | static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
unsigned int flags)
{
struct ext4_extent_header *neh;
struct buffer_head *bh;
ext4_fsblk_t newblock, goal = 0;
struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
int err = 0;
/* Try to prepend new index to old one */
if (ext_dep... | DoS | 0 | static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
unsigned int flags)
{
struct ext4_extent_header *neh;
struct buffer_head *bh;
ext4_fsblk_t newblock, goal = 0;
struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
int err = 0;
/* Try to prepend new index to old one */
if (ext_dep... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,960 | int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
struct ext4_ext_path **ppath,
struct ext4_extent *newext, int gb_flags)
{
struct ext4_ext_path *path = *ppath;
struct ext4_extent_header *eh;
struct ext4_extent *ex, *fex;
struct ext4_extent *nearex; /* nearest extent */
struct ext4_ext_path... | DoS | 0 | int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
struct ext4_ext_path **ppath,
struct ext4_extent *newext, int gb_flags)
{
struct ext4_ext_path *path = *ppath;
struct ext4_extent_header *eh;
struct ext4_extent *ex, *fex;
struct ext4_extent *nearex; /* nearest extent */
struct ext4_ext_path... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,961 | ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path,
ext4_lblk_t block)
{
int depth = ext_depth(inode);
ext4_lblk_t len;
ext4_lblk_t lblock;
struct ext4_extent *ex;
struct extent_status es;
ex = path[depth].p_ext;
if (ex == NULL) {
/* there is no extent yet, so gap is [0;-] */
lblo... | DoS | 0 | ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path,
ext4_lblk_t block)
{
int depth = ext_depth(inode);
ext4_lblk_t len;
ext4_lblk_t lblock;
struct ext4_extent *ex;
struct extent_status es;
ex = path[depth].p_ext;
if (ex == NULL) {
/* there is no extent yet, so gap is [0;-] */
lblo... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,962 | int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
ext4_lblk_t end)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
int depth = ext_depth(inode);
struct ext4_ext_path *path = NULL;
long long partial_cluster = 0;
handle_t *handle;
int i = 0, err = 0;
ext_debug("truncate since %u to %u\n", ... | DoS | 0 | int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
ext4_lblk_t end)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
int depth = ext_depth(inode);
struct ext4_ext_path *path = NULL;
long long partial_cluster = 0;
handle_t *handle;
int i = 0, err = 0;
ext_debug("truncate since %u to %u\n", ... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,963 | static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path, int depth)
{
int err;
ext4_fsblk_t leaf;
/* free index block */
depth--;
path = path + depth;
leaf = ext4_idx_pblock(path->p_idx);
if (unlikely(path->p_hdr->eh_entries == 0)) {
EXT4_ERROR_INODE(inode, "path->p_hdr... | DoS | 0 | static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path, int depth)
{
int err;
ext4_fsblk_t leaf;
/* free index block */
depth--;
path = path + depth;
leaf = ext4_idx_pblock(path->p_idx);
if (unlikely(path->p_hdr->eh_entries == 0)) {
EXT4_ERROR_INODE(inode, "path->p_hdr... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,964 | ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path,
long long *partial_cluster,
ext4_lblk_t start, ext4_lblk_t end)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
int err = 0, correct_index = 0;
int depth = ext_depth(inode), credits;
struct ext4_extent_header *eh;
ext4_... | DoS | 0 | ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path,
long long *partial_cluster,
ext4_lblk_t start, ext4_lblk_t end)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
int err = 0, correct_index = 0;
int depth = ext_depth(inode), credits;
struct ext4_extent_header *eh;
ext4_... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,965 | ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
ext4_lblk_t start, ext4_lblk_t shift)
{
struct ext4_ext_path *path;
int ret = 0, depth;
struct ext4_extent *extent;
ext4_lblk_t stop_block;
ext4_lblk_t ex_start, ex_end;
/* Let path point to the last extent */
path = ext4_find_extent(inode, ... | DoS | 0 | ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
ext4_lblk_t start, ext4_lblk_t shift)
{
struct ext4_ext_path *path;
int ret = 0, depth;
struct ext4_extent *extent;
ext4_lblk_t stop_block;
ext4_lblk_t ex_start, ex_end;
/* Let path point to the last extent */
path = ext4_find_extent(inode, ... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,966 | ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift,
struct inode *inode, handle_t *handle,
ext4_lblk_t *start)
{
int depth, err = 0;
struct ext4_extent *ex_start, *ex_last;
bool update = 0;
depth = path->p_depth;
while (depth >= 0) {
if (depth == path->p_depth) {
ex_start... | DoS | 0 | ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift,
struct inode *inode, handle_t *handle,
ext4_lblk_t *start)
{
int depth, err = 0;
struct ext4_extent *ex_start, *ex_last;
bool update = 0;
depth = path->p_depth;
while (depth >= 0) {
if (depth == path->p_depth) {
ex_start... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,967 | static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path)
{
int depth = ext_depth(inode);
struct ext4_extent_header *eh;
struct ext4_extent *ex;
int i;
if (!path)
return;
eh = path[depth].p_hdr;
ex = EXT_FIRST_EXTENT(eh);
ext_debug("Displaying leaf extents for inode %lu\n", inode->i_i... | DoS | 0 | static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path)
{
int depth = ext_depth(inode);
struct ext4_extent_header *eh;
struct ext4_extent *ex;
int i;
if (!path)
return;
eh = path[depth].p_hdr;
ex = EXT_FIRST_EXTENT(eh);
ext_debug("Displaying leaf extents for inode %lu\n", inode->i_i... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,968 | static void ext4_ext_show_move(struct inode *inode, struct ext4_ext_path *path,
ext4_fsblk_t newblock, int level)
{
int depth = ext_depth(inode);
struct ext4_extent *ex;
if (depth != level) {
struct ext4_extent_idx *idx;
idx = path[level].p_idx;
while (idx <= EXT_MAX_INDEX(path[level].p_hdr)) {
ext_debu... | DoS | 0 | static void ext4_ext_show_move(struct inode *inode, struct ext4_ext_path *path,
ext4_fsblk_t newblock, int level)
{
int depth = ext_depth(inode);
struct ext4_extent *ex;
if (depth != level) {
struct ext4_extent_idx *idx;
idx = path[level].p_idx;
while (idx <= EXT_MAX_INDEX(path[level].p_hdr)) {
ext_debu... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,969 | static void ext4_ext_show_path(struct inode *inode, struct ext4_ext_path *path)
{
int k, l = path->p_depth;
ext_debug("path:");
for (k = 0; k <= l; k++, path++) {
if (path->p_idx) {
ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block),
ext4_idx_pblock(path->p_idx));
} else if (path->p_ext) {
... | DoS | 0 | static void ext4_ext_show_path(struct inode *inode, struct ext4_ext_path *path)
{
int k, l = path->p_depth;
ext_debug("path:");
for (k = 0; k <= l; k++, path++) {
if (path->p_idx) {
ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block),
ext4_idx_pblock(path->p_idx));
} else if (path->p_ext) {
... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,970 | static int ext4_ext_split(handle_t *handle, struct inode *inode,
unsigned int flags,
struct ext4_ext_path *path,
struct ext4_extent *newext, int at)
{
struct buffer_head *bh = NULL;
int depth = ext_depth(inode);
struct ext4_extent_header *neh;
struct ext4_extent_idx *fidx;
int i = at, k, m, a;
ext4... | DoS | 0 | static int ext4_ext_split(handle_t *handle, struct inode *inode,
unsigned int flags,
struct ext4_ext_path *path,
struct ext4_extent *newext, int at)
{
struct buffer_head *bh = NULL;
int depth = ext_depth(inode);
struct ext4_extent_header *neh;
struct ext4_extent_idx *fidx;
int i = at, k, m, a;
ext4... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,971 | int ext4_ext_tree_init(handle_t *handle, struct inode *inode)
{
struct ext4_extent_header *eh;
eh = ext_inode_hdr(inode);
eh->eh_depth = 0;
eh->eh_entries = 0;
eh->eh_magic = EXT4_EXT_MAGIC;
eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0));
ext4_mark_inode_dirty(handle, inode);
return 0;
}
| DoS | 0 | int ext4_ext_tree_init(handle_t *handle, struct inode *inode)
{
struct ext4_extent_header *eh;
eh = ext_inode_hdr(inode);
eh->eh_depth = 0;
eh->eh_entries = 0;
eh->eh_magic = EXT4_EXT_MAGIC;
eh->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0));
ext4_mark_inode_dirty(handle, inode);
return 0;
}
| @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,972 | static void ext4_ext_try_to_merge_up(handle_t *handle,
struct inode *inode,
struct ext4_ext_path *path)
{
size_t s;
unsigned max_root = ext4_ext_space_root(inode, 0);
ext4_fsblk_t blk;
if ((path[0].p_depth != 1) ||
(le16_to_cpu(path[0].p_hdr->eh_entries) != 1) ||
(le16_to_cpu(path[1].p_... | DoS | 0 | static void ext4_ext_try_to_merge_up(handle_t *handle,
struct inode *inode,
struct ext4_ext_path *path)
{
size_t s;
unsigned max_root = ext4_ext_space_root(inode, 0);
ext4_fsblk_t blk;
if ((path[0].p_depth != 1) ||
(le16_to_cpu(path[0].p_hdr->eh_entries) != 1) ||
(le16_to_cpu(path[1].p_... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,973 | static __le32 ext4_extent_block_csum(struct inode *inode,
struct ext4_extent_header *eh)
{
struct ext4_inode_info *ei = EXT4_I(inode);
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
__u32 csum;
csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)eh,
EXT4_EXTENT_TAIL_OFFSET(eh));
return cpu_to_le32(c... | DoS | 0 | static __le32 ext4_extent_block_csum(struct inode *inode,
struct ext4_extent_header *eh)
{
struct ext4_inode_info *ei = EXT4_I(inode);
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
__u32 csum;
csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)eh,
EXT4_EXTENT_TAIL_OFFSET(eh));
return cpu_to_le32(c... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,974 | static void ext4_extent_block_csum_set(struct inode *inode,
struct ext4_extent_header *eh)
{
struct ext4_extent_tail *et;
if (!ext4_has_metadata_csum(inode->i_sb))
return;
et = find_ext4_extent_tail(eh);
et->et_checksum = ext4_extent_block_csum(inode, eh);
}
| DoS | 0 | static void ext4_extent_block_csum_set(struct inode *inode,
struct ext4_extent_header *eh)
{
struct ext4_extent_tail *et;
if (!ext4_has_metadata_csum(inode->i_sb))
return;
et = find_ext4_extent_tail(eh);
et->et_checksum = ext4_extent_block_csum(inode, eh);
}
| @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,975 | static int ext4_extent_block_csum_verify(struct inode *inode,
struct ext4_extent_header *eh)
{
struct ext4_extent_tail *et;
if (!ext4_has_metadata_csum(inode->i_sb))
return 1;
et = find_ext4_extent_tail(eh);
if (et->et_checksum != ext4_extent_block_csum(inode, eh))
return 0;
return 1;
}
| DoS | 0 | static int ext4_extent_block_csum_verify(struct inode *inode,
struct ext4_extent_header *eh)
{
struct ext4_extent_tail *et;
if (!ext4_has_metadata_csum(inode->i_sb))
return 1;
et = find_ext4_extent_tail(eh);
if (et->et_checksum != ext4_extent_block_csum(inode, eh))
return 0;
return 1;
}
| @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,976 | long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
{
struct inode *inode = file_inode(file);
loff_t new_size = 0;
unsigned int max_blocks;
int ret = 0;
int flags;
ext4_lblk_t lblk;
unsigned int blkbits = inode->i_blkbits;
/* Return error if mode is not supported */
if (mode & ~(FALLOC... | DoS | 0 | long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
{
struct inode *inode = file_inode(file);
loff_t new_size = 0;
unsigned int max_blocks;
int ret = 0;
int flags;
ext4_lblk_t lblk;
unsigned int blkbits = inode->i_blkbits;
/* Return error if mode is not supported */
if (mode & ~(FALLOC... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,977 | int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len)
{
ext4_lblk_t start_blk;
int error = 0;
if (ext4_has_inline_data(inode)) {
int has_inline = 1;
error = ext4_inline_data_fiemap(inode, fieinfo, &has_inline,
start, len);
if (has_inline)
return error;
... | DoS | 0 | int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len)
{
ext4_lblk_t start_blk;
int error = 0;
if (ext4_has_inline_data(inode)) {
int has_inline = 1;
error = ext4_inline_data_fiemap(inode, fieinfo, &has_inline,
start, len);
if (has_inline)
return error;
... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,978 | static int ext4_fill_fiemap_extents(struct inode *inode,
ext4_lblk_t block, ext4_lblk_t num,
struct fiemap_extent_info *fieinfo)
{
struct ext4_ext_path *path = NULL;
struct ext4_extent *ex;
struct extent_status es;
ext4_lblk_t next, next_del, start = 0, end = 0;
ext4_lblk_t last = block + num;
int... | DoS | 0 | static int ext4_fill_fiemap_extents(struct inode *inode,
ext4_lblk_t block, ext4_lblk_t num,
struct fiemap_extent_info *fieinfo)
{
struct ext4_ext_path *path = NULL;
struct ext4_extent *ex;
struct extent_status es;
ext4_lblk_t next, next_del, start = 0, end = 0;
ext4_lblk_t last = block + num;
int... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,979 | int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
ext4_lblk_t lblk_start, lblk_end;
lblk_start = EXT4_LBLK_CMASK(sbi, lblk);
lblk_end = lblk_start + sbi->s_cluster_ratio - 1;
return ext4_find_delalloc_range(inode, lblk_start, lblk_end);
}
| DoS | 0 | int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
ext4_lblk_t lblk_start, lblk_end;
lblk_start = EXT4_LBLK_CMASK(sbi, lblk);
lblk_end = lblk_start + sbi->s_cluster_ratio - 1;
return ext4_find_delalloc_range(inode, lblk_start, lblk_end);
}
| @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,980 | int ext4_find_delalloc_range(struct inode *inode,
ext4_lblk_t lblk_start,
ext4_lblk_t lblk_end)
{
struct extent_status es;
ext4_es_find_delayed_extent_range(inode, lblk_start, lblk_end, &es);
if (es.es_len == 0)
return 0; /* there is no delay extent in this tree */
else if (es.es_lblk <= lblk_sta... | DoS | 0 | int ext4_find_delalloc_range(struct inode *inode,
ext4_lblk_t lblk_start,
ext4_lblk_t lblk_end)
{
struct extent_status es;
ext4_es_find_delayed_extent_range(inode, lblk_start, lblk_end, &es);
if (es.es_len == 0)
return 0; /* there is no delay extent in this tree */
else if (es.es_lblk <= lblk_sta... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,981 | static int ext4_find_delayed_extent(struct inode *inode,
struct extent_status *newes)
{
struct extent_status es;
ext4_lblk_t block, next_del;
if (newes->es_pblk == 0) {
ext4_es_find_delayed_extent_range(inode, newes->es_lblk,
newes->es_lblk + newes->es_len - 1, &es);
/*
* No extent in extent-tre... | DoS | 0 | static int ext4_find_delayed_extent(struct inode *inode,
struct extent_status *newes)
{
struct extent_status es;
ext4_lblk_t block, next_del;
if (newes->es_pblk == 0) {
ext4_es_find_delayed_extent_range(inode, newes->es_lblk,
newes->es_lblk + newes->es_len - 1, &es);
/*
* No extent in extent-tre... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,982 | static int ext4_split_extent_at(handle_t *handle,
struct inode *inode,
struct ext4_ext_path **ppath,
ext4_lblk_t split,
int split_flag,
int flags)
{
struct ext4_ext_path *path = *ppath;
ext4_fsblk_t newblock;
ext4_lblk_t ee_block;
struct ext4_extent *ex, newex, orig_ex, zero_... | DoS | 0 | static int ext4_split_extent_at(handle_t *handle,
struct inode *inode,
struct ext4_ext_path **ppath,
ext4_lblk_t split,
int split_flag,
int flags)
{
struct ext4_ext_path *path = *ppath;
ext4_fsblk_t newblock;
ext4_lblk_t ee_block;
struct ext4_extent *ex, newex, orig_ex, zero_... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,983 | ext4_swap_extents(handle_t *handle, struct inode *inode1,
struct inode *inode2, ext4_lblk_t lblk1, ext4_lblk_t lblk2,
ext4_lblk_t count, int unwritten, int *erp)
{
struct ext4_ext_path *path1 = NULL;
struct ext4_ext_path *path2 = NULL;
int replaced_count = 0;
BUG_ON(!rwsem_is_locked(&EXT4_I(inode1)->i_d... | DoS | 0 | ext4_swap_extents(handle_t *handle, struct inode *inode1,
struct inode *inode2, ext4_lblk_t lblk1, ext4_lblk_t lblk2,
ext4_lblk_t count, int unwritten, int *erp)
{
struct ext4_ext_path *path1 = NULL;
struct ext4_ext_path *path2 = NULL;
int replaced_count = 0;
BUG_ON(!rwsem_is_locked(&EXT4_I(inode1)->i_d... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,984 | static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
{
ext4_fsblk_t block = ext4_ext_pblock(ext);
int len = ext4_ext_get_actual_len(ext);
ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
ext4_lblk_t last = lblock + len - 1;
if (lblock > last)
return 0;
return ext4_data_block_valid(EXT4_SB... | DoS | 0 | static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
{
ext4_fsblk_t block = ext4_ext_pblock(ext);
int len = ext4_ext_get_actual_len(ext);
ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
ext4_lblk_t last = lblock + len - 1;
if (lblock > last)
return 0;
return ext4_data_block_valid(EXT4_SB... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,985 | static int ext4_valid_extent_entries(struct inode *inode,
struct ext4_extent_header *eh,
int depth)
{
unsigned short entries;
if (eh->eh_entries == 0)
return 1;
entries = le16_to_cpu(eh->eh_entries);
if (depth == 0) {
/* leaf entries */
struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
struct ext4_s... | DoS | 0 | static int ext4_valid_extent_entries(struct inode *inode,
struct ext4_extent_header *eh,
int depth)
{
unsigned short entries;
if (eh->eh_entries == 0)
return 1;
entries = le16_to_cpu(eh->eh_entries);
if (depth == 0) {
/* leaf entries */
struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
struct ext4_s... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,986 | static int ext4_xattr_fiemap(struct inode *inode,
struct fiemap_extent_info *fieinfo)
{
__u64 physical = 0;
__u64 length;
__u32 flags = FIEMAP_EXTENT_LAST;
int blockbits = inode->i_sb->s_blocksize_bits;
int error = 0;
/* in-inode? */
if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
struct ext4_iloc i... | DoS | 0 | static int ext4_xattr_fiemap(struct inode *inode,
struct fiemap_extent_info *fieinfo)
{
__u64 physical = 0;
__u64 length;
__u32 flags = FIEMAP_EXTENT_LAST;
int blockbits = inode->i_sb->s_blocksize_bits;
int error = 0;
/* in-inode? */
if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
struct ext4_iloc i... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,987 | static int ext4_zeroout_es(struct inode *inode, struct ext4_extent *ex)
{
ext4_lblk_t ee_block;
ext4_fsblk_t ee_pblock;
unsigned int ee_len;
ee_block = le32_to_cpu(ex->ee_block);
ee_len = ext4_ext_get_actual_len(ex);
ee_pblock = ext4_ext_pblock(ex);
if (ee_len == 0)
return 0;
return ext4_es_insert_ext... | DoS | 0 | static int ext4_zeroout_es(struct inode *inode, struct ext4_extent *ex)
{
ext4_lblk_t ee_block;
ext4_fsblk_t ee_pblock;
unsigned int ee_len;
ee_block = le32_to_cpu(ex->ee_block);
ee_len = ext4_ext_get_actual_len(ex);
ee_pblock = ext4_ext_pblock(ex);
if (ee_len == 0)
return 0;
return ext4_es_insert_ext... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,988 | static inline int get_default_free_blocks_flags(struct inode *inode)
{
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
return EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET;
else if (ext4_should_journal_data(inode))
return EXT4_FREE_BLOCKS_FORGET;
return 0;
}
| DoS | 0 | static inline int get_default_free_blocks_flags(struct inode *inode)
{
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
return EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET;
else if (ext4_should_journal_data(inode))
return EXT4_FREE_BLOCKS_FORGET;
return 0;
}
| @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,989 | static int get_implied_cluster_alloc(struct super_block *sb,
struct ext4_map_blocks *map,
struct ext4_extent *ex,
struct ext4_ext_path *path)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
ext4_lblk_t c_offset = EXT4_LBLK_COFF(sbi, map->m_lblk);
ext4_lblk_t ex_cluster_start, ex_cluster_end;
ex... | DoS | 0 | static int get_implied_cluster_alloc(struct super_block *sb,
struct ext4_map_blocks *map,
struct ext4_extent *ex,
struct ext4_ext_path *path)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
ext4_lblk_t c_offset = EXT4_LBLK_COFF(sbi, map->m_lblk);
ext4_lblk_t ex_cluster_start, ex_cluster_end;
ex... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,990 | get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start,
unsigned int num_blks)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
ext4_lblk_t alloc_cluster_start, alloc_cluster_end;
ext4_lblk_t lblk_from, lblk_to, c_offset;
unsigned int allocated_clusters = 0;
alloc_cluster_start = EXT4_B2C(... | DoS | 0 | get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start,
unsigned int num_blks)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
ext4_lblk_t alloc_cluster_start, alloc_cluster_end;
ext4_lblk_t lblk_from, lblk_to, c_offset;
unsigned int allocated_clusters = 0;
alloc_cluster_start = EXT4_B2C(... | @@ -4797,12 +4797,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
else
max_blocks -= lblk;
- flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT |
- EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
- EXT4_EX_NOCACHE;
- if (mode & FALLOC_FL_KEEP_SIZE)
- flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
-
mutex_lock(&inode->i_... | CWE-17 | null | null |
35,991 | xfs_attr_fillstate(xfs_da_state_t *state)
{
xfs_da_state_path_t *path;
xfs_da_state_blk_t *blk;
int level;
trace_xfs_attr_fillstate(state->args);
/*
* Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path".
*/
path = &state->path;
ASSERT((path->act... | DoS +Priv | 0 | xfs_attr_fillstate(xfs_da_state_t *state)
{
xfs_da_state_path_t *path;
xfs_da_state_blk_t *blk;
int level;
trace_xfs_attr_fillstate(state->args);
/*
* Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path".
*/
path = &state->path;
ASSERT((path->act... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,992 | xfs_attr_get_int(
struct xfs_inode *ip,
struct xfs_name *name,
unsigned char *value,
int *valuelenp,
int flags)
{
xfs_da_args_t args;
int error;
if (!xfs_inode_hasattr(ip))
return ENOATTR;
/*
* Fill in the arg structure for this request.
*/
memset((char *)&args, 0, sizeof(args));
... | DoS +Priv | 0 | xfs_attr_get_int(
struct xfs_inode *ip,
struct xfs_name *name,
unsigned char *value,
int *valuelenp,
int flags)
{
xfs_da_args_t args;
int error;
if (!xfs_inode_hasattr(ip))
return ENOATTR;
/*
* Fill in the arg structure for this request.
*/
memset((char *)&args, 0, sizeof(args));
... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,993 | xfs_attr_leaf_get(xfs_da_args_t *args)
{
struct xfs_buf *bp;
int error;
trace_xfs_attr_leaf_get(args);
args->blkno = 0;
error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, -1, &bp);
if (error)
return error;
error = xfs_attr3_leaf_lookup_int(bp, args);
if (error != EEXIST) {
xfs_trans_brelse(... | DoS +Priv | 0 | xfs_attr_leaf_get(xfs_da_args_t *args)
{
struct xfs_buf *bp;
int error;
trace_xfs_attr_leaf_get(args);
args->blkno = 0;
error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, -1, &bp);
if (error)
return error;
error = xfs_attr3_leaf_lookup_int(bp, args);
if (error != EEXIST) {
xfs_trans_brelse(... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,994 | xfs_attr_leaf_removename(xfs_da_args_t *args)
{
xfs_inode_t *dp;
struct xfs_buf *bp;
int error, committed, forkoff;
trace_xfs_attr_leaf_removename(args);
/*
* Remove the attribute.
*/
dp = args->dp;
args->blkno = 0;
error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, -1, &bp);
if (error)
re... | DoS +Priv | 0 | xfs_attr_leaf_removename(xfs_da_args_t *args)
{
xfs_inode_t *dp;
struct xfs_buf *bp;
int error, committed, forkoff;
trace_xfs_attr_leaf_removename(args);
/*
* Remove the attribute.
*/
dp = args->dp;
args->blkno = 0;
error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, -1, &bp);
if (error)
re... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,995 | xfs_attr_name_to_xname(
struct xfs_name *xname,
const unsigned char *aname)
{
if (!aname)
return EINVAL;
xname->name = aname;
xname->len = strlen((char *)aname);
if (xname->len >= MAXNAMELEN)
return EFAULT; /* match IRIX behaviour */
return 0;
}
| DoS +Priv | 0 | xfs_attr_name_to_xname(
struct xfs_name *xname,
const unsigned char *aname)
{
if (!aname)
return EINVAL;
xname->name = aname;
xname->len = strlen((char *)aname);
if (xname->len >= MAXNAMELEN)
return EFAULT; /* match IRIX behaviour */
return 0;
}
| @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,996 | xfs_attr_node_get(xfs_da_args_t *args)
{
xfs_da_state_t *state;
xfs_da_state_blk_t *blk;
int error, retval;
int i;
trace_xfs_attr_node_get(args);
state = xfs_da_state_alloc();
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_sb.sb_blocksize;
state->node_ents = state->mp->m_... | DoS +Priv | 0 | xfs_attr_node_get(xfs_da_args_t *args)
{
xfs_da_state_t *state;
xfs_da_state_blk_t *blk;
int error, retval;
int i;
trace_xfs_attr_node_get(args);
state = xfs_da_state_alloc();
state->args = args;
state->mp = args->dp->i_mount;
state->blocksize = state->mp->m_sb.sb_blocksize;
state->node_ents = state->mp->m_... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,997 | xfs_attr_node_removename(xfs_da_args_t *args)
{
xfs_da_state_t *state;
xfs_da_state_blk_t *blk;
xfs_inode_t *dp;
struct xfs_buf *bp;
int retval, error, committed, forkoff;
trace_xfs_attr_node_removename(args);
/*
* Tie a string around our finger to remind us where we are.
*/
dp = args->dp;
state = xfs_da... | DoS +Priv | 0 | xfs_attr_node_removename(xfs_da_args_t *args)
{
xfs_da_state_t *state;
xfs_da_state_blk_t *blk;
xfs_inode_t *dp;
struct xfs_buf *bp;
int retval, error, committed, forkoff;
trace_xfs_attr_node_removename(args);
/*
* Tie a string around our finger to remind us where we are.
*/
dp = args->dp;
state = xfs_da... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,998 | xfs_attr_refillstate(xfs_da_state_t *state)
{
xfs_da_state_path_t *path;
xfs_da_state_blk_t *blk;
int level, error;
trace_xfs_attr_refillstate(state->args);
/*
* Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path".
*/
path = &state->path;
ASSERT... | DoS +Priv | 0 | xfs_attr_refillstate(xfs_da_state_t *state)
{
xfs_da_state_path_t *path;
xfs_da_state_blk_t *blk;
int level, error;
trace_xfs_attr_refillstate(state->args);
/*
* Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path".
*/
path = &state->path;
ASSERT... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
35,999 | xfs_attr_remove(
xfs_inode_t *dp,
const unsigned char *name,
int flags)
{
int error;
struct xfs_name xname;
XFS_STATS_INC(xs_attr_remove);
if (XFS_FORCED_SHUTDOWN(dp->i_mount))
return (EIO);
error = xfs_attr_name_to_xname(&xname, name);
if (error)
return error;
xfs_ilock(dp, XFS_ILOCK_SHARED);
if (... | DoS +Priv | 0 | xfs_attr_remove(
xfs_inode_t *dp,
const unsigned char *name,
int flags)
{
int error;
struct xfs_name xname;
XFS_STATS_INC(xs_attr_remove);
if (XFS_FORCED_SHUTDOWN(dp->i_mount))
return (EIO);
error = xfs_attr_name_to_xname(&xname, name);
if (error)
return error;
xfs_ilock(dp, XFS_ILOCK_SHARED);
if (... | @@ -213,7 +213,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but
* make room for the attribute value itself.
*/
- uint dblocks = XFS_B_TO_FSB(mp, valuelen);
+ uint dblocks = xfs_attr3_rmt_blocks(mp, valuelen);
nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, ... | CWE-19 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.