All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Roberto Sassu <roberto.sassu@huaweicloud.com>,
	zohar@linux.ibm.com, dmitry.kasatkin@gmail.com
Cc: linux-integrity@vger.kernel.org, vt@altlinux.org, pvorel@suse.cz,
	Roberto Sassu <roberto.sassu@huawei.com>
Subject: Re: [PATCH ima-evm-utils v3 07/11] Add tests for EVM portable signatures
Date: Wed, 25 Jan 2023 18:15:14 -0500	[thread overview]
Message-ID: <d9c60317-5371-6d3a-3f7c-c71011e0a126@linux.ibm.com> (raw)
In-Reply-To: <20230125085030.1568256-8-roberto.sassu@huaweicloud.com>



On 1/25/23 03:50, Roberto Sassu wrote:
> From: Roberto Sassu <roberto.sassu@huawei.com>
> 

> +
> +	last_char=${ima_xattr: -1}

To avoid last_char from spilling into the global variable space I would declare it as local. I would do this for **every** variable.

An example from functions.sh:

_evmctl_run() {
   local op=$1 out=$1-$$.out
   local text_for=${FOR:+for $ADD_TEXT_FOR}
   # Additional parameters:
   # ADD_DEL: additional files to rm on failure
   # ADD_TEXT_FOR: append to text as 'for $ADD_TEXT_FOR'

   cmd="evmctl $V $EVMCTL_ENGINE $*"
   echo $YELLOW$TMODE "$cmd"$NORM
   $cmd >"$out" 2>&1
   ret=$?

[...]
}

If I have a function like this here calling _evmctl_run() it will clobber even my local-declared ret and cmd variables because neither is declared as local in _evmctl_run.

foo() {
   local ret=123
   local cmd="mycmd"
   [...]
   _evmctl_run ...
   # my ret and cmd are now clobbered!
}


   Stefan

  reply	other threads:[~2023-01-25 23:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25  8:50 [PATCH ima-evm-utils v3 00/11] Support testing in new enviroments Roberto Sassu
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 01/11] Fix error messages and vars in calc_evm_hmac() Roberto Sassu
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 02/11] Add config for UML kernel Roberto Sassu
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 03/11] Compile the UML kernel and download it in Github Actions Roberto Sassu
2023-01-25 19:17   ` Mimi Zohar
2023-01-26  9:09     ` Roberto Sassu
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 04/11] Pass cleanup function and its arguments to _report_exit_and_cleanup() Roberto Sassu
2023-01-25 13:52   ` Stefan Berger
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 05/11] Add support for creating a new testing environment in functions.sh Roberto Sassu
2023-01-25 13:36   ` Roberto Sassu
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 06/11] Introduce TST_LIST variable to select a test to execute Roberto Sassu
2023-01-25 14:06   ` Stefan Berger
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 07/11] Add tests for EVM portable signatures Roberto Sassu
2023-01-25 23:15   ` Stefan Berger [this message]
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 08/11] Adapt fsverity.test to be able to run in a new testing environment Roberto Sassu
2023-01-25 22:45   ` Stefan Berger
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 09/11] Use in-place built fsverity binary instead of installing it Roberto Sassu
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 10/11] ci: haveged requires EPEL on CentOS stream:8 Roberto Sassu
2023-01-25  8:50 ` [PATCH ima-evm-utils v3 11/11] Temporarily remove CONFIG_DEBUG_SG to test portable signatures Roberto Sassu

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=d9c60317-5371-6d3a-3f7c-c71011e0a126@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=roberto.sassu@huawei.com \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=vt@altlinux.org \
    --cc=zohar@linux.ibm.com \
    /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 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.