Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1379262
| From | "Gabriel L. Somlo" <somlo@cmu.edu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [patch] firmware: qemu_fw_cfg.c: potential unintialized variable |
| Date | 2016-04-14 21:40 +0200 |
| Message-ID | <rnVho-7bz-7@gated-at.bofh.it> (permalink) |
| References | <rnLUL-83r-43@gated-at.bofh.it> <rnUv0-6rs-27@gated-at.bofh.it> <rnUY1-71M-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Apr 14, 2016 at 10:12:53PM +0300, Dan Carpenter wrote: > On Thu, Apr 14, 2016 at 02:40:06PM -0400, Gabriel L. Somlo wrote: > > On Thu, Apr 14, 2016 at 12:33:37PM +0300, Dan Carpenter wrote: > > > It acpi_acquire_global_lock() return AE_NOT_CONFIGURED then "glk" isn't > > ^ ^ > > If returns > > > > > initialized, which, if you got very unlucky, could cause a bug. > > > > > > In principle I'm OK with being cautious and initializing local > > variables just in case, but I'm curious: > > > > acpi_acquire_global_lock() (and its friend, acpi_release_global_lock()) > > are both wrapped inside the same macro -- ACPI_HW_DEPENDENT_RETURN_STATUS > > -- which either makes them both do something useful, or makes them both > > no-ops returning a hardcoded AE_NOT_CONFIGURED. > > > > So what else do you think could be a way to get very unlucky ? > > If "glk" happened to to equal acpi_gbl_global_lock_handle by chance > then we would release it without acquiring it first. Actually I could > initialize it to zero and that would be better, no? No, because acpi_release_global_lock() would also be a hard-coded "return AE_NOT_CONFIGURED" by the same macro which also hard-coded acpi_acquire_global_lock() to be "return AE_NOT_CONFIGURED" in the first place. See include/acpi/acpixf.h, search for the two occurrences of "#define ACPI_HW_DEPENDENT_RETURN_STATUS" and then for: "global_lock" further down in the file. Whether both (or neither) of lock/unlock are for real or just hardcoded to return AE_NOT_CONFIGURED depends on ACPI_REDUCED_HARDWARE, which I assume is also set when there's *no* ACPI hardware at all. But I don't believe it's possible for "unlock" to do anything at all if "lock" was hardcoded to simply return AE_NOT_CONFIGURED. Then again, it's possible I'm still missing something :) Thanks, --Gabe
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch] firmware: qemu_fw_cfg.c: potential unintialized variable Dan Carpenter <dan.carpenter@oracle.com> - 2016-04-14 11:40 +0200
Re: [patch] firmware: qemu_fw_cfg.c: potential unintialized variable "Gabriel L. Somlo" <somlo@cmu.edu> - 2016-04-14 20:50 +0200
Re: [patch] firmware: qemu_fw_cfg.c: potential unintialized variable Dan Carpenter <dan.carpenter@oracle.com> - 2016-04-14 21:20 +0200
Re: [patch] firmware: qemu_fw_cfg.c: potential unintialized variable "Gabriel L. Somlo" <somlo@cmu.edu> - 2016-04-14 21:40 +0200
Re: [patch] firmware: qemu_fw_cfg.c: potential unintialized variable Dan Carpenter <dan.carpenter@oracle.com> - 2016-04-14 22:10 +0200
Re: [patch] firmware: qemu_fw_cfg.c: potential unintialized variable "Gabriel L. Somlo" <somlo@cmu.edu> - 2016-04-14 22:00 +0200
csiph-web