[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 06/10] stubdom/xenstored: Fix uninitialised variables in lu_read_state()


  • To: Jürgen Groß <jgross@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 15 Feb 2021 14:12:22 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1qMNtljXf0apYUhwBsXK9LdL5JcXbm/+2a8v3UZBFRk=; b=hJJT9ae7mvyWuryvVntmTMFhVq+wnqep0llrQAbLvJ6izIt+D02aFpfn4Rhgqo2QxNGvMKVDKqKEt4FTOjG28coamxbQYHF/JnwIK+ZHfnt16QytZpLxcXtz9uQn45OOyuPSk3csOSpmpv/pK8He1qxGktmyk8H2+PJQXykmP9Lgp5Q0CZwI8+9XWNdeBQw5I0fsQBs8yQFVwA85PrlErkqJki1S/HqRvg76/cmxEeD8cTrBkHwCuuUbDtLiL0uN6jZ0zqacdUfFCiD2SYKvN/N6+rkpNMoZW8u6FixTwaFeSEsI1o1G1Z4zVQbpFOF68ELh2T6OC5SvSrIg+p30lA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IIRPFr+9Jglby9el1e31ysQrKWz9T+nSYBgvIQdG4W3MbiTvz/XgTjNQdExVMvFj6tFOlbEPb01xClNuizpngqoAbxQ/y6OHFozxPOC64dMgLjXJ/pI6emEKQdsSVC9dWxPyPmRbrg4iLVMB8CtT43CseDWiw3OtItuREF9b67rp5ePjwpPN+YQjjmAMYlKhpvlnc0Ul+5Acm28fV3WZVJcUwynoGrNi/KcI25vfcSvC0VfFTnSO4g3Ch+l82hM84sjRxmYXm0Zrmk+4Nqb09AZ6QPpJMUlUi6Sj96rFc+n/7J/nqdsUBGSVdyV5glI36fITDyRfZ1Ghm8WbRdgwFQ==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 15 Feb 2021 14:12:42 +0000
  • Ironport-sdr: 4INl3YANdjwqMDXki9S+VLEORqNKwZj6XhjD1LlZmvUdPY0MNTM/SxwFASPUVeQOh7r3G8FSyh G1PMiQxn4oNNObx4dJbGCK8Y/bwNJl2BQRBq0fH7K/xT8sYgihNg5kJUDrddqkd2BLtU8I+Bbe sQcamMA3940jATEqt0WGuipmy227E6IeKZxDntDDfefKYqaoHURnCTItBtcZ+k7kupHQFYqxrf y1B1CLkfLwwk52UYhvzGL4+buMzSUJIQMsTWxLexAVS4P3f/s+16y5LHI+mRK4yIA1nZ+8enVl ERk=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13/02/2021 09:36, Jürgen Groß wrote:
> On 12.02.21 18:01, Andrew Cooper wrote:
>> On 12/02/2021 16:08, Jürgen Groß wrote:
>>> On 12.02.21 16:39, Andrew Cooper wrote:
>>>> Various version of gcc, when compiling with -Og, complain:
>>>>
>>>>     xenstored_control.c: In function ‘lu_read_state’:
>>>>     xenstored_control.c:540:11: error: ‘state.size’ is used
>>>> uninitialized in this
>>>>     function [-Werror=uninitialized]
>>>>       if (state.size == 0)
>>>>           ~~~~~^~~~~
>>>>     xenstored_control.c:543:6: error: ‘state.buf’ may be used
>>>> uninitialized in
>>>>     this function [-Werror=maybe-uninitialized]
>>>>       pre = state.buf;
>>>>       ~~~~^~~~~~~~~~~
>>>>     xenstored_control.c:550:23: error: ‘state.buf’ may be used
>>>> uninitialized in
>>>>     this function [-Werror=maybe-uninitialized]
>>>>        (void *)head - state.buf < state.size;
>>>>                       ~~~~~^~~~
>>>>     xenstored_control.c:550:35: error: ‘state.size’ may be used
>>>> uninitialized in
>>>>     this function [-Werror=maybe-uninitialized]
>>>>        (void *)head - state.buf < state.size;
>>>>                                   ~~~~~^~~~~
>>>>
>>>> Interestingly, this is only in the stubdom build.  I can't identify
>>>> any
>>>> relevant differences vs the regular tools build.
>>>
>>> But me. :-)
>>>
>>> lu_get_dump_state() is empty for the stubdom case (this will change
>>> when
>>> LU is implemented for stubdom, too). In the daemon case this
>>> function is
>>> setting all the fields which are relevant.
>>
>> So I spotted that.  This instance of lu_read_state() is already within
>> the ifdefary, so doesn't get to see the empty stub (I think).
>
> There is only one instance of lu_read_state().

Ahh - I got the NO_LIVE_UPDATE and __MINIOS__ ifdefary inverted.  (It is
very confusing to follow).

I'll reword the commit message, but leave the fix the same.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.