* [PATCH] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()
@ 2019-01-14 2:19 Wei Yang
2019-01-14 4:41 ` Dan Williams
2019-01-15 3:09 ` [PATCH v2] " Wei Yang
0 siblings, 2 replies; 5+ messages in thread
From: Wei Yang @ 2019-01-14 2:19 UTC (permalink / raw)
To: linux-nvdimm; +Cc: Wei Yang, zwisler
We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
ndr_desc, while the assignment is done twice in this function.
This patch removes the second assignment. No functional change.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
drivers/acpi/nfit/core.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 5912d30020c7..7b66d701d8ac 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2260,7 +2260,6 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
}
}
- ndr_desc->nd_set = nd_set;
devm_kfree(dev, info);
devm_kfree(dev, info2);
--
2.19.1
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()
2019-01-14 2:19 [PATCH] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set() Wei Yang
@ 2019-01-14 4:41 ` Dan Williams
2019-01-15 3:04 ` Wei Yang
2019-01-15 3:09 ` [PATCH v2] " Wei Yang
1 sibling, 1 reply; 5+ messages in thread
From: Dan Williams @ 2019-01-14 4:41 UTC (permalink / raw)
To: Wei Yang; +Cc: Ross Zwisler, linux-nvdimm
On Sun, Jan 13, 2019 at 6:19 PM Wei Yang <richardw.yang@linux.intel.com> wrote:
>
> We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
> ndr_desc, while the assignment is done twice in this function.
>
> This patch removes the second assignment. No functional change.
I think it makes more sense to remove the first assignment. Don't let
an uninitialized nd_set escape that routine. Either ->nd_set is left
NULL or it points to an initialized instance instead of potentially a
zeroed one.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()
2019-01-14 4:41 ` Dan Williams
@ 2019-01-15 3:04 ` Wei Yang
0 siblings, 0 replies; 5+ messages in thread
From: Wei Yang @ 2019-01-15 3:04 UTC (permalink / raw)
To: Dan Williams; +Cc: Ross Zwisler, Wei Yang, linux-nvdimm
On Sun, Jan 13, 2019 at 08:41:11PM -0800, Dan Williams wrote:
>On Sun, Jan 13, 2019 at 6:19 PM Wei Yang <richardw.yang@linux.intel.com> wrote:
>>
>> We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
>> ndr_desc, while the assignment is done twice in this function.
>>
>> This patch removes the second assignment. No functional change.
>
>I think it makes more sense to remove the first assignment. Don't let
>an uninitialized nd_set escape that routine. Either ->nd_set is left
>NULL or it points to an initialized instance instead of potentially a
>zeroed one.
Agree, I should be more careful.
--
Wei Yang
Help you, Help me
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()
2019-01-14 2:19 [PATCH] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set() Wei Yang
2019-01-14 4:41 ` Dan Williams
@ 2019-01-15 3:09 ` Wei Yang
2019-01-15 3:13 ` Dan Williams
1 sibling, 1 reply; 5+ messages in thread
From: Wei Yang @ 2019-01-15 3:09 UTC (permalink / raw)
To: linux-nvdimm; +Cc: Wei Yang, zwisler
We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
ndr_desc, while the assignment is done twice in this function.
This patch removes the first assignment. No functional change.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
v2:
* remove the first assignment to avoid some leak
---
drivers/acpi/nfit/core.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 5912d30020c7..9c3c2d2f37be 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2187,7 +2187,6 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL);
if (!nd_set)
return -ENOMEM;
- ndr_desc->nd_set = nd_set;
guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid);
info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL);
--
2.19.1
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()
2019-01-15 3:09 ` [PATCH v2] " Wei Yang
@ 2019-01-15 3:13 ` Dan Williams
0 siblings, 0 replies; 5+ messages in thread
From: Dan Williams @ 2019-01-15 3:13 UTC (permalink / raw)
To: Wei Yang; +Cc: Ross Zwisler, linux-nvdimm
On Mon, Jan 14, 2019 at 7:10 PM Wei Yang <richardw.yang@linux.intel.com> wrote:
>
> We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
> ndr_desc, while the assignment is done twice in this function.
>
> This patch removes the first assignment. No functional change.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>
> ---
> v2:
> * remove the first assignment to avoid some leak
Looks good, applied.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-15 3:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-14 2:19 [PATCH] acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set() Wei Yang
2019-01-14 4:41 ` Dan Williams
2019-01-15 3:04 ` Wei Yang
2019-01-15 3:09 ` [PATCH v2] " Wei Yang
2019-01-15 3:13 ` Dan Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox