mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Ilya Dryomov <idryomov@gmail.com>,
	Jeff Layton <jlayton@kernel.org>, Sage Weil <sage@redhat.co>,
	ceph-devel@vger.kernel.org
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: libceph: follow redirect replies from osds
Date: Fri, 28 Feb 2020 12:46:11 +0000	[thread overview]
Message-ID: <6ea7e486-a3f3-7def-1f88-2e645e3b9780@canonical.com> (raw)

Hi,

Static analysis with Coverity has detected a potential issue in the
following commit in function ceph_redirect_decode():

commit 205ee1187a671c3b067d7f1e974903b44036f270
Author: Ilya Dryomov <ilya.dryomov@inktank.com>
Date:   Mon Jan 27 17:40:20 2014 +0200

    libceph: follow redirect replies from osds

The issue is as follows:


3486        len = ceph_decode_32(p);

Unused value (UNUSED_VALUE)
assigned_pointer: Assigning value from len to *p here, but that stored
value is overwritten before it can be used.

3487        *p += len; /* skip osd_instructions */
3488
3489        /* skip the rest */

value_overwrite: Overwriting previous write to *p with value from
struct_end.

3490        *p = struct_end;

The *p assignment in line 3487 is effectively being overwritten by the
*p assignment in 3490.  Maybe the following is correct:

        len = ceph_decode_32(p);
-       p += len; /* skip osd_instructions */
+       struct_end = *p + len;  /* skip osd_instructions */

        /* skip the rest */
        *p = struct_end;

I'm not familiar with the ceph structure here, so I'm not sure what the
correct fix would be.

Colin

             reply	other threads:[~2020-02-28 12:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 12:46 Colin Ian King [this message]
2020-02-28 14:01 ` Jeff Layton
2020-02-28 14:13   ` Ilya Dryomov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ea7e486-a3f3-7def-1f88-2e645e3b9780@canonical.com \
    --to=colin.king@canonical.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@redhat.co \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®