On Fri, Sep 17, 2021 at 02:58:09PM +0200, Tim Wiederhake wrote:
This helps to bring down the frame size of virNWFilterRuleDefFixup,
as it
exceeds 8192 bytes when libvirt is build with sanitizers enabled, in debug
mode, on clang.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/nwfilter_conf.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index a3109962af..62334edeec 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2189,23 +2189,23 @@ virNWFilterRuleValidate(virNWFilterRuleDef *rule)
static void
virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
{
+ ethHdrDataDef *ethHdr;
+
#define COPY_NEG_SIGN(A, B) \
(A).flags = ((A).flags & ~NWFILTER_ENTRY_ITEM_FLAG_IS_NEG) | \
((B).flags & NWFILTER_ENTRY_ITEM_FLAG_IS_NEG);
switch (rule->prtclType) {
case VIR_NWFILTER_RULE_PROTOCOL_MAC:
- COPY_NEG_SIGN(rule->p.ethHdrFilter.ethHdr.dataSrcMACMask,
- rule->p.ethHdrFilter.ethHdr.dataSrcMACAddr);
- COPY_NEG_SIGN(rule->p.ethHdrFilter.ethHdr.dataDstMACMask,
- rule->p.ethHdrFilter.ethHdr.dataDstMACAddr);
+ ethHdr = &rule->p.ethHdrFilter.ethHdr;
+ COPY_NEG_SIGN(ethHdr->dataSrcMACMask, ethHdr->dataSrcMACAddr);
+ COPY_NEG_SIGN(ethHdr->dataDstMACMask, ethHdr->dataDstMACAddr);
I don't get why this reduces stack size at all ?
COPY_NEG_SIGN is just doing a bitwise and + or + assignment
which doesn't require any intermediate variables.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|