From: Erwan Velu <erwan@enovance.com>
To: fio@vger.kernel.org
Subject: [Pull Request] Various fixes reported by Clang
Date: Mon, 22 Jul 2013 23:56:55 +0200 [thread overview]
Message-ID: <51EDAAA7.4070103@enovance.com> (raw)
Hey,
I had the curiosity to check how fio was considered by clang.
The "--analyze" option of clang is something levering interesting bugs.
In fact, there is many false positive but some were real.
I've been pushing a branch featuring the associated fixes. That's almost
nothing but I cannot close my eyes on it ;o)
Cheers,
Erwan
The following changes since commit d7e30e61f2c1d9c6101cc6896009750aae2e2bcf:
fio2gnuplot: Don't plot fake data (2013-07-22 19:39:24 +0200)
are available in the git repository at:
git@github.com:enovance/fio.git clang
for you to fetch changes up to 2fdbefdd43968f3bf354a488288b9794b5f5c6bb:
core: Insure "il" is initialized in all cases (2013-07-22 23:48:48 +0200)
----------------------------------------------------------------
Erwan Velu (3):
core: Removing duplicated code
core: Don't leak memory if error is unknown
core: Insure "il" is initialized in all cases
init.c | 2 --
options.c | 1 +
parse.c | 2 +-
stat.c | 6 ++----
4 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/init.c b/init.c
index 70b56e3..d808eb6 100644
--- a/init.c
+++ b/init.c
@@ -1755,8 +1755,6 @@ int parse_cmd_line(int argc, char *argv[], int
client_type)
case FIO_GETOPT_IOENGINE: {
const char *opt = l_opts[lidx].name;
char *val = optarg;
- opt = l_opts[lidx].name;
- val = optarg;
ret = fio_cmd_ioengine_option_parse(td, opt, val);
break;
}
diff --git a/options.c b/options.c
index 6462c67..1c44f42 100644
--- a/options.c
+++ b/options.c
@@ -271,6 +271,7 @@ static int ignore_error_type(struct thread_data *td,
int etype, char *str)
if (!error[i]) {
log_err("Unknown error %s, please use number value \n",
fname);
+ free(error);
return 1;
}
i++;
diff --git a/parse.c b/parse.c
index f54dae6..d3eb2c4 100644
--- a/parse.c
+++ b/parse.c
@@ -380,7 +380,7 @@ static int str_match_len(const struct value_pair
*vp, const char *str)
static int __handle_option(struct fio_option *o, const char *ptr, void
*data,
int first, int more, int curr)
{
- int il, *ilp;
+ int il=0, *ilp;
fio_fp64_t *flp;
long long ull, *ullp;
long ul1, ul2;
diff --git a/stat.c b/stat.c
index 332ccd0..442caa0 100644
--- a/stat.c
+++ b/stat.c
@@ -243,15 +243,13 @@ out:
int calc_lat(struct io_stat *is, unsigned long *min, unsigned long *max,
double *mean, double *dev)
{
- double n = is->samples;
+ double n = (double) is->samples;
- if (is->samples == 0)
+ if (n == 0)
return 0;
*min = is->min_val;
*max = is->max_val;
-
- n = (double) is->samples;
*mean = is->mean.u.f;
if (n > 1.0)
next reply other threads:[~2013-07-22 21:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-22 21:56 Erwan Velu [this message]
2013-07-23 2:56 ` [Pull Request] Various fixes reported by Clang Jens Axboe
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=51EDAAA7.4070103@enovance.com \
--to=erwan@enovance.com \
--cc=fio@vger.kernel.org \
/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.