* [PATCH] fs:ceph: Remove unused variables in ceph_mdsmap_decode()
@ 2020-07-20 11:40 Jia Yang
2020-07-20 20:24 ` Jeff Layton
0 siblings, 1 reply; 3+ messages in thread
From: Jia Yang @ 2020-07-20 11:40 UTC (permalink / raw)
To: jlayton, idryomov; +Cc: ceph-devel, jiayang5
Fix build warnings:
fs/ceph/mdsmap.c: In function ‘ceph_mdsmap_decode’:
fs/ceph/mdsmap.c:192:7: warning:
variable ‘info_cv’ set but not used [-Wunused-but-set-variable]
fs/ceph/mdsmap.c:177:7: warning:
variable ‘state_seq’ set but not used [-Wunused-but-set-variable]
fs/ceph/mdsmap.c:123:15: warning:
variable ‘mdsmap_cv’ set but not used [-Wunused-but-set-variable]
Signed-off-by: Jia Yang <jiayang5@huawei.com>
---
fs/ceph/mdsmap.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index 889627817e52..9496287f2071 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -120,7 +120,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
const void *start = *p;
int i, j, n;
int err;
- u8 mdsmap_v, mdsmap_cv;
+ u8 mdsmap_v;
u16 mdsmap_ev;
m = kzalloc(sizeof(*m), GFP_NOFS);
@@ -129,7 +129,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
ceph_decode_need(p, end, 1 + 1, bad);
mdsmap_v = ceph_decode_8(p);
- mdsmap_cv = ceph_decode_8(p);
if (mdsmap_v >= 4) {
u32 mdsmap_len;
ceph_decode_32_safe(p, end, mdsmap_len, bad);
@@ -174,7 +173,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
u64 global_id;
u32 namelen;
s32 mds, inc, state;
- u64 state_seq;
u8 info_v;
void *info_end = NULL;
struct ceph_entity_addr addr;
@@ -189,9 +187,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
info_v= ceph_decode_8(p);
if (info_v >= 4) {
u32 info_len;
- u8 info_cv;
ceph_decode_need(p, end, 1 + sizeof(u32), bad);
- info_cv = ceph_decode_8(p);
info_len = ceph_decode_32(p);
info_end = *p + info_len;
if (info_end > end)
@@ -210,7 +206,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
mds = ceph_decode_32(p);
inc = ceph_decode_32(p);
state = ceph_decode_32(p);
- state_seq = ceph_decode_64(p);
err = ceph_decode_entity_addr(p, end, &addr);
if (err)
goto corrupt;
--
2.26.0.106.g9fadedd
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs:ceph: Remove unused variables in ceph_mdsmap_decode()
2020-07-20 11:40 [PATCH] fs:ceph: Remove unused variables in ceph_mdsmap_decode() Jia Yang
@ 2020-07-20 20:24 ` Jeff Layton
2020-07-22 12:50 ` Jia Yang
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2020-07-20 20:24 UTC (permalink / raw)
To: Jia Yang, idryomov; +Cc: ceph-devel
On Mon, 2020-07-20 at 19:40 +0800, Jia Yang wrote:
> Fix build warnings:
>
> fs/ceph/mdsmap.c: In function ‘ceph_mdsmap_decode’:
> fs/ceph/mdsmap.c:192:7: warning:
> variable ‘info_cv’ set but not used [-Wunused-but-set-variable]
> fs/ceph/mdsmap.c:177:7: warning:
> variable ‘state_seq’ set but not used [-Wunused-but-set-variable]
> fs/ceph/mdsmap.c:123:15: warning:
> variable ‘mdsmap_cv’ set but not used [-Wunused-but-set-variable]
>
> Signed-off-by: Jia Yang <jiayang5@huawei.com>
> ---
> fs/ceph/mdsmap.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
> index 889627817e52..9496287f2071 100644
> --- a/fs/ceph/mdsmap.c
> +++ b/fs/ceph/mdsmap.c
> @@ -120,7 +120,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
> const void *start = *p;
> int i, j, n;
> int err;
> - u8 mdsmap_v, mdsmap_cv;
> + u8 mdsmap_v;
> u16 mdsmap_ev;
>
> m = kzalloc(sizeof(*m), GFP_NOFS);
> @@ -129,7 +129,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
>
> ceph_decode_need(p, end, 1 + 1, bad);
> mdsmap_v = ceph_decode_8(p);
> - mdsmap_cv = ceph_decode_8(p);
These decode calls have the side effect of incrementing "p", so this
will break decoding. You can still get rid of them, but you'll want to
convert them to ceph_decode_skip_* calls.
> if (mdsmap_v >= 4) {
> u32 mdsmap_len;
> ceph_decode_32_safe(p, end, mdsmap_len, bad);
> @@ -174,7 +173,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
> u64 global_id;
> u32 namelen;
> s32 mds, inc, state;
> - u64 state_seq;
> u8 info_v;
> void *info_end = NULL;
> struct ceph_entity_addr addr;
> @@ -189,9 +187,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
> info_v= ceph_decode_8(p);
> if (info_v >= 4) {
> u32 info_len;
> - u8 info_cv;
> ceph_decode_need(p, end, 1 + sizeof(u32), bad);
> - info_cv = ceph_decode_8(p);
> info_len = ceph_decode_32(p);
> info_end = *p + info_len;
> if (info_end > end)
> @@ -210,7 +206,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
> mds = ceph_decode_32(p);
> inc = ceph_decode_32(p);
> state = ceph_decode_32(p);
> - state_seq = ceph_decode_64(p);
> err = ceph_decode_entity_addr(p, end, &addr);
> if (err)
> goto corrupt;
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs:ceph: Remove unused variables in ceph_mdsmap_decode()
2020-07-20 20:24 ` Jeff Layton
@ 2020-07-22 12:50 ` Jia Yang
0 siblings, 0 replies; 3+ messages in thread
From: Jia Yang @ 2020-07-22 12:50 UTC (permalink / raw)
To: Jeff Layton, idryomov; +Cc: ceph-devel
Thanks a lot!
On 2020/7/21 4:24, Jeff Layton wrote:
> On Mon, 2020-07-20 at 19:40 +0800, Jia Yang wrote:
>> Fix build warnings:
>>
>> fs/ceph/mdsmap.c: In function ‘ceph_mdsmap_decode’:
>> fs/ceph/mdsmap.c:192:7: warning:
>> variable ‘info_cv’ set but not used [-Wunused-but-set-variable]
>> fs/ceph/mdsmap.c:177:7: warning:
>> variable ‘state_seq’ set but not used [-Wunused-but-set-variable]
>> fs/ceph/mdsmap.c:123:15: warning:
>> variable ‘mdsmap_cv’ set but not used [-Wunused-but-set-variable]
>>
>> Signed-off-by: Jia Yang <jiayang5@huawei.com>
>> ---
>> fs/ceph/mdsmap.c | 7 +------
>> 1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
>> index 889627817e52..9496287f2071 100644
>> --- a/fs/ceph/mdsmap.c
>> +++ b/fs/ceph/mdsmap.c
>> @@ -120,7 +120,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
>> const void *start = *p;
>> int i, j, n;
>> int err;
>> - u8 mdsmap_v, mdsmap_cv;
>> + u8 mdsmap_v;
>> u16 mdsmap_ev;
>>
>> m = kzalloc(sizeof(*m), GFP_NOFS);
>> @@ -129,7 +129,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
>>
>> ceph_decode_need(p, end, 1 + 1, bad);
>> mdsmap_v = ceph_decode_8(p);
>> - mdsmap_cv = ceph_decode_8(p);
>
> These decode calls have the side effect of incrementing "p", so this
> will break decoding. You can still get rid of them, but you'll want to
> convert them to ceph_decode_skip_* calls.
>
>> if (mdsmap_v >= 4) {
>> u32 mdsmap_len;
>> ceph_decode_32_safe(p, end, mdsmap_len, bad);
>> @@ -174,7 +173,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
>> u64 global_id;
>> u32 namelen;
>> s32 mds, inc, state;
>> - u64 state_seq;
>> u8 info_v;
>> void *info_end = NULL;
>> struct ceph_entity_addr addr;
>> @@ -189,9 +187,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
>> info_v= ceph_decode_8(p);
>> if (info_v >= 4) {
>> u32 info_len;
>> - u8 info_cv;
>> ceph_decode_need(p, end, 1 + sizeof(u32), bad);
>> - info_cv = ceph_decode_8(p);
>> info_len = ceph_decode_32(p);
>> info_end = *p + info_len;
>> if (info_end > end)
>> @@ -210,7 +206,6 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
>> mds = ceph_decode_32(p);
>> inc = ceph_decode_32(p);
>> state = ceph_decode_32(p);
>> - state_seq = ceph_decode_64(p);
>> err = ceph_decode_entity_addr(p, end, &addr);
>> if (err)
>> goto corrupt;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-22 12:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 11:40 [PATCH] fs:ceph: Remove unused variables in ceph_mdsmap_decode() Jia Yang
2020-07-20 20:24 ` Jeff Layton
2020-07-22 12:50 ` Jia Yang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.