* [Pull Request] Various fixes reported by Clang
@ 2013-07-22 21:56 Erwan Velu
2013-07-23 2:56 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Erwan Velu @ 2013-07-22 21:56 UTC (permalink / raw)
To: fio
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)
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Pull Request] Various fixes reported by Clang
2013-07-22 21:56 [Pull Request] Various fixes reported by Clang Erwan Velu
@ 2013-07-23 2:56 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2013-07-23 2:56 UTC (permalink / raw)
To: Erwan Velu; +Cc: fio
On Mon, Jul 22 2013, Erwan Velu wrote:
> 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)
Thanks, all three look good. Thanks for wading through the false
positives to find the gold :-)
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-23 2:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22 21:56 [Pull Request] Various fixes reported by Clang Erwan Velu
2013-07-23 2:56 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox