jffs2: remove redundant check on outpos > pos
Subsystems (3)
PATCH 1/1 jffs2: remove redundant check on outpos > pos
The check for outpos > pos is always false because outpos is zero and pos is at least zero; outpos can never be greater than pos. The check is redundant and can be removed.
--- fs/jffs2/compr_rubin.c | 5 ----- 1 file changed, 5 deletions(-)
fs/jffs2/compr_rubin.c +0 -5
@@ -276,11 +276,6 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,end_rubin (&rs); -if (outpos > pos) { -/* We failed */ -return -1 ; - } -/* Tell the caller how much we managed to compress, * and how much space it took */
Signature · 1 line
2.39.5
Quoted 14 lines · Colin Ian King
The check for outpos > pos is always false because outpos is zero and pos is at least zero; outpos can never be greater than pos. The check is redundant and can be removed.
Signed-off-by Colin Ian King <[email protected]>--- fs/jffs2/compr_rubin.c | 5 ----- 1 file changed, 5 deletions(-)fs/jffs2/compr_rubin.c +0
-0
fs/jffs2/compr_rubin.c static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in, · line 278
Quoted 3 lines
fs/jffs2/compr_rubin.c +0
-0@@ -276,11 +276,6 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,end_rubin (&rs);
Maybe this check could detect the overflow of 'pos', I guess.
Quoted 9 lines
fs/jffs2/compr_rubin.c +0
-5-if (outpos > pos) { -/* We failed */ -return -1 ; - } -/* Tell the caller how much we managed to compress, * and how much space it took */
Quoted 10 lines · Zhihao Cheng
Quoted 9 lines · Colin Ian King
The check for outpos > pos is always false because outpos is zero and pos is at least zero; outpos can never be greater than pos. The check is redundant and can be removed.
Signed-off-by Colin Ian King <[email protected]>--- fs/jffs2/compr_rubin.c | 5 ----- 1 file changed, 5 deletions(-)
Quoted 8 lines
fs/jffs2/compr_rubin.c static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in, · line 276
Quoted 6 lines
fs/jffs2/compr_rubin.c +0
-0@@ -276,11 +276,6 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,end_rubin (&rs);Maybe this check could detect the overflow of 'pos', I guess.
"pos" is a number between 0 and 4. It can't overflow.
regards,
dan carpenter