Re: [PATCH v1 1/2] libtracefs: Move initialization below a null test.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 15 Dec 2022 10:31:50 -0800
Ian Rogers <irogers@xxxxxxxxxx> wrote:

> Computing the address from a NULL pointer results in undefined behavior
> which things like undefined behavior sanitizer promote into real
> failures.

I thought commit aff006d4af0c7 ("libtracefs: Do not initialize with NULL
offsets") was suppose to fix this.

Oh, I think I may have forgotten to remove the check against dynevent!

Does this work instead?

-- Steve

diff --git a/src/tracefs-dynevents.c b/src/tracefs-dynevents.c
index 48bb26a96c58..7a3c45ce25a3 100644
--- a/src/tracefs-dynevents.c
+++ b/src/tracefs-dynevents.c
@@ -713,9 +713,6 @@ dynevent_info(struct tracefs_dynevent *dynevent, char **system,
 			&dynevent->address, &dynevent->format };
 	int i;
 
-	if (!dynevent)
-		return TRACEFS_DYNEVENT_UNKNOWN;
-
 	for (i = 0; i < ARRAY_SIZE(lv); i++) {
 		if (lv[i]) {
 			if (*rv[i]) {



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux