<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">On 5/30/22, 6:10 AM, "Michal Prívozník" <mprivozn@redhat.com> wrote:<o:p></o:p></p>
<p class="MsoNormal"><br>
> > +    for (i = 0; i < def->nmems; i++) {<o:p></o:p></p>
<p class="MsoNormal">> > +        /* sgx epc memory does not support hotplug */<o:p></o:p></p>
<p class="MsoNormal">> > +        if (def->mems[i]->model != VIR_DOMAIN_MEMORY_MODEL_SGX_EPC) {<o:p></o:p></p>
<p class="MsoNormal">> <o:p></o:p></p>
<p class="MsoNormal">> This is very, very easy to overlook. I mean the condition. Also, notice<o:p></o:p></p>
<p class="MsoNormal">> how when you added new memory type compiler identified all the places<o:p></o:p></p>
<p class="MsoNormal">> you need to adjust? That's because I've rewrote the code to use switch()<o:p></o:p></p>
<p class="MsoNormal">> everywhere. And this new code goes against that direction.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks for pointing this out. I will update it to use switch() style instead of<o:p></o:p></p>
<p class="MsoNormal">if condition. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Lin.<o:p></o:p></p>
</div>
</body>
</html>