Commit Graph

59357 Commits

Author SHA1 Message Date
Murai Takashi
3fb9ab7fb6 bus_managers/firewire: Fix PVS 396
Fix 'info' is assigned values twice successively.

Change-Id: I981d3176a41a5f7616ef5a20dae889f1f01525bd
Reviewed-on: https://review.haiku-os.org/764
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-14 22:52:42 +00:00
Adrien Destugues
16a54a87fd Merge usb_floppy back into usb_disk.
- USB pen drive seems to still work. More extensive testing welcome.
- USB floppies don't work yet, but they don't work anymore with the
  current driver, either. I'm still investigating that part.

Fixes #9276

Change-Id: I8aa5ab828ad2ad867d0c187062d6e179372fc2ad
Reviewed-on: https://review.haiku-os.org/747
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-14 22:51:44 +00:00
Peter Kosyh
6fa279737e IMAP: sync fixes
This patch should fix:

- deadlocks while manual syncing/shutdown;
- crashes while manual syncing/shutdown.

Change-Id: I0962ff5580c19cbf740d002b6f62681ed5f558ab
Reviewed-on: https://review.haiku-os.org/758
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2018-12-13 09:32:35 +00:00
Augustin Cavalier
e7e7a55250 kernel/fs: Account for vnode being NULL in vfs_release_posix_lock.
When the FD is put() but not freed while O_DISCONNECTED, its "ops"
and "vnode" are cleared. Thus it is entirely valid for a non-NULL
file FD to have a NULL vnode, so we should just treat such FDs
as if the locks had already been cleared (which they should have.)

Fixes #14294.
2018-12-12 19:24:59 -05:00
Augustin Cavalier
bee962a25e kernel/fs: Consumers of context->fds[] must check O_DISCONNECTED.
Since these do not go through get_fd, which would check for them,
we need to do these checks manually in the relevant locations.

Some of these changes were broken out from axeld's original commit,
and some were found by my own auditing.
2018-12-12 19:05:14 -05:00
Augustin Cavalier
64d1636fea kernel: Rework the FD disconnect feature (again).
axeld's solution from 2015 worked in that it solved the panics and
problems with leaking FDs ... but only if nobody actually tried to
use the FDs again. As you can see in the diff of the previous commit,
in allowing closed FDs (which have NULL "ops") to be returned by get_fd,
all consumers of the get_fd API (so, pretty much most functions in
vfs.cpp and fd.cpp) have to check *both* that (1) the fd is not NULL,
and (2) the fd does not have O_DISCONNECT set.

Besides missing a large majority of consumers of get_fd (which caused
ticket #14532 and also the first half of ticket #14756, probably among
others, as I haven't reviewed all NULL-dereference-in-VFS tickets yet)
this solution missed the fact that calling get_fd increments the reference
count, but then exiting the exact same way as if the FD was NULL
(without putting it) when it is disconnected *also* leaks the FD.

As it turns out, a not insignificant number of applications try
to do this, which (depending on whether you went through one of the
'lucky' functions axeld's commit touched) either (1) leaked the FD,
or (2) caused a kernel panic.

Now, we could go through and add O_DISCONNECT checks to every single
consumer of get_fd followed by put_fd to get the proper behavior ...
but that would be the same thing as just returning NULL here and not
incrementing the reference count.

So it seems the first part of axeld's solution (don't set open_count
or ref_count to -1 but leave them as-is) is the only change necessary.

A few places where there were legitimately missing O_DISCONNECT checks
(some originally added by axeld) are (re-)added in the next commit.
Otherwise this seems to be the more robust solution. (But I wonder why
nobody caught this in the code review axeld asked for in the commit
and the ticket back in 2015? Did nobody notice the unbalanced get/put?)

Fixes #14532, part of #14756, and probably any other NULL dereferences
in VFS I/O functions (XHCI is especially good at exposing these)
that are lingering around on the bugtracker.
2018-12-12 18:42:03 -05:00
Augustin Cavalier
15ec0b5cc8 Revert "VFS: Slight rework of the FD disconnect feature."
This reverts commit eb62d3337b.
2018-12-12 18:40:04 -05:00
Augustin Cavalier
675e5dfcac Mandelbrot: GCC2 fix. 2018-12-12 18:13:18 -05:00
kerwizzy
e5aeaa8d03 Mandelbrot: Implement subsampling
* Added subsampling. This makes the render look less noisy and generally nicer.

Change-Id: I1dd667c8799bd97fb84e1401976da12ecf74ea8c
Reviewed-on: https://review.haiku-os.org/732
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-12 22:17:24 +00:00
Murai Takashi
2e7e161dfb drivesetup: Fix PVS 832
Fix 'parentRow' is assigned values twice successively.

Change-Id: I57a1dec60f651c49eb05f3038b62c49c29eb2ff0
Reviewed-on: https://review.haiku-os.org/763
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-12 22:07:19 +00:00
Murai Takashi
9d9ca63110 glibc: Fix -Wheader-guard
Fix typo in header guard, pointed out by clang.
See also https://sourceware.org/git/?p=glibc.git;a=commit;h=9947638d74f490b8ec9a1563c195881a4151bd80

Change-Id: I6e01c67ed246d4be48463abc490bbb9ba4c76342
Reviewed-on: https://review.haiku-os.org/762
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-12 22:06:23 +00:00
Murai Takashi
382eca52a2 zipomatic: Fix PVS 1103
Fix 'status' is assigned values twice successively.

Change-Id: I348799db32342f0642dac89a62a518d21ef11c34
Reviewed-on: https://review.haiku-os.org/761
Reviewed-by: Barrett17 <b.vitruvio@gmail.com>
2018-12-12 21:31:56 +00:00
Murai Takashi
b6766af3e6 cortex: Fix PVS 1504
Fix 'r' is assigned values twice successively.

Change-Id: Ia46786badb1235f16c42e09eb9e9fb750fb2bf29
Reviewed-on: https://review.haiku-os.org/760
Reviewed-by: Barrett17 <b.vitruvio@gmail.com>
2018-12-12 21:31:53 +00:00
Augustin Cavalier
67f185ecf5 kernel: Don't retry or wait for the low_resource handler.
As axeld pointed out on the mailing list, map_backing_store is called
with the address space write-locked, and so the resources won't be
released until after we return.

Due to the state we are in at this point, unlocking the address space
before making this call would be likely be very dangerous, and so
simply issuing the notification and then returning an error is all
we can safely do here.
2018-12-12 10:55:43 -05:00
Murai Takashi
07af264afa ipv4: Fix PVS 2464
Fix using local variable within a loop with a same name
as a variable controlling this loop.

Change-Id: Ie920807a56e51b32844ac13ff1d8c564466d3a83
Reviewed-on: https://review.haiku-os.org/751
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-11 19:51:20 +00:00
Augustin Cavalier
f1e8678942 kernel: Notify low resource handler & retry when low on kernel address space.
Solves a decade-old TODO. This might help with strange behavior in
low-memory conditions.
2018-12-11 14:44:52 -05:00
Augustin Cavalier
0a347c90d5 kernel: Minor style cleanup to arch_altcodepatch.
No functional change intended.
2018-12-11 13:38:13 -05:00
Augustin Cavalier
8a1709b3af vm: Allow W|X before kernel startup ends.
The altcodepatch mechanism needs to overwrite parts of the kernel
image. This can't be done by setting it to RW-only and not RWX,
as we are already running within the kernel when this occurs,
and so instruction fetches can and will occur between the points
of +W and -W.

As gKernelStartup is turned off before the scheduler is started,
this is not much of a lifted restriction, as no modules are loaded,
no secondary threads started, etc.

Fixes #14751.
2018-12-11 13:37:39 -05:00
Augustin Cavalier
08858e10fa kernel_cpp: Don't import all of the "std" namespace.
This file is included, directly or indirectly, by most of the
kernel-space C++ code, and so importing the entirety of "std"
seriously pollutes the global namespace.

So instead, just import "std::nothrow", which is the only thing
we really want in the global namespace. Tested on both GCC2
and GCC7 and seems to work just fine.

While I'm here, also update the include guards and copyright
header to match the standard format used elsewhere.
2018-12-10 19:44:07 -05:00
Augustin Cavalier
cac9cf1565 kernel: Staticize id_generator's GeneratorList object.
Spotted by Clang.
2018-12-10 19:17:08 -05:00
Augustin Cavalier
8844a67e90 More trivial syntax and logic cleanup.
Spotted by Clang. No functional change intended.
2018-12-10 19:16:19 -05:00
Alexander von Gluck IV
b279d6def1 busses/mmc/sdhci_pci: Return B_UNHANDLED_INTERRUPT at end of non-void func
* I'm making an assumption here this is the desired result since interrupts
  are unhandled at the end of the function.
* Pointed out by gcc
2018-12-10 16:01:07 +00:00
Augustin Cavalier
4089701dbd interface: Remove some unreachable "break"s.
Spotted by Clang.
2018-12-09 23:04:45 -05:00
Augustin Cavalier
ee0b0d6dac kernel: Fix typos in documentation.
Spotted by Clang (yes, there is a -Wdocumentation that understands
how to parse Doxygen comments!)
2018-12-09 23:04:00 -05:00
Augustin Cavalier
5d78c2d7e0 kernel: Remove some unused macros.
Spotted by Clang. (I double-checked they weren't used within
some #ifdef'd-out code, too.)
2018-12-09 23:03:11 -05:00
Augustin Cavalier
bc3fc95ff6 kernel: encode_glyph shouldn't be used outside convertutf, make it static.
Spotted by Clang.
2018-12-09 23:02:13 -05:00
Augustin Cavalier
6b83d77fb7 smp: Make {acquire|release}_read_seqlock_inline cast explicitly.
Also fix braces.
2018-12-09 23:01:42 -05:00
Augustin Cavalier
86c12bf05b kernel: Initialize all fields of rw_lock in RW_LOCK_INITIALIZER.
Spotted by Clang.
2018-12-09 23:01:11 -05:00
Augustin Cavalier
5dd66afb7d headers: Remove some extra semicolons.
Spotted by Clang.
2018-12-09 23:00:47 -05:00
Augustin Cavalier
cb0977326d kernel: Enforce W^X protection for kernel areas.
We already adhere to this in the kernel itself as well as all
in-tree drivers, so we might as well actually enforce it now.
2018-12-09 15:19:08 -05:00
EXL
f232d9d22c AboutSystem: Minor fix for opening links
It looks like it unfolds to:
> /bin/open /bin/open https://www.example.com

Instead of the expected:
> /bin/open https://www.example.com

See "src/kits/app/Roster.cpp", BRoster::ArgVector::Init() method:
    // init vector
    if (error == B_OK) {
        fArgs[0] = fAppPath.Path(); // Here
        if (argc > 0 && args != NULL) {
            for (int i = 0; i < argc; i++)
                fArgs[i + 1] = args[i];
            if (hasDocArg)
                fArgs[fArgc - 1] = fDocPath.Path();
        }
        // NULL terminate (e.g. required by load_image())
        fArgs[fArgc] = NULL;
    }

Change-Id: Ie7e7155377637b93cbc3c1d225cb91b5e0d2dd7d
Reviewed-on: https://review.haiku-os.org/754
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-09 19:33:55 +00:00
Humdinger
dbbac33163 Mail: save vertical space in the header when reading mail
The layout is unchanged for writing an email.

Changes when reading an email:

* decrease vertical spacing between rows
* move "To" to the right of "From" in the first row
* move "CC" to the right of "Date" in the second row
* move "Subject" down to the last, 3rd row

"CC" still only shows when it contains data.

This is a comparison of the old (left) and new (right) layout:
https://linx.li/new-mail.png

TODO:
It would be nice if the "To" and "CC" were right-aligned.

Change-Id: I89c758bc16af03838e6e3206b2983f451f6044b2
Reviewed-on: https://review.haiku-os.org/753
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-09 19:33:22 +00:00
Alexander von Gluck IV
6e48605b8f kernel: Add riscv config_manager and kernel lib arch sources
Change-Id: Idb40e98f4f664e6bfe0af6bc098bae5c871fb4e5
2018-12-08 16:46:17 -06:00
Barrett17
b6c5bdbd39 MediaFile: Properly use BMediaExtractor::GetMetaData 2018-12-07 18:53:48 +01:00
Alexander von Gluck IV
eb4dd41b42 system/glue: Get your arm outta my risc!
Change-Id: Ie000430275df9be5568d7d8e330743120691ac4f
2018-12-05 10:30:42 -06:00
Alexander von Gluck IV
7dcd941df2 riscv32/64: Stub out some core architecture code
Change-Id: I437dff816e87ec5692cca0aaacaada27b43089ee
2018-12-05 10:14:18 -06:00
Murai Takashi
e28abad762 userlandfs: Fix -Werror=parentheses
Remove unnecessary parentheses in declaration of pointers.
Pointed out by gcc8.

Change-Id: I6f56b12349b6c8433f7ce237f5ce5d7af45bf103
Reviewed-on: https://review.haiku-os.org/750
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Skipp_OSX <jscipione@gmail.com>
2018-12-04 20:46:43 +00:00
Adrien Destugues
5490645d16 ffmpeg: Undo changes to frame time computation
I was misled by ffmpeg docs, the timestamp is indeed in microseconds
already at this point.
2018-12-04 19:16:29 +01:00
Murai Takashi
53ffd9513d libntfs: Fix -Wsizeof-array-decay
Fix sizeof() parameter since sizeof(buffer - 1) returns size of pointer,
not size of array. Pointed out by clang.

Change-Id: Ib0be8a9de65c24a787e5817ea70a1cfc1c14b18f
Reviewed-on: https://review.haiku-os.org/743
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-04 12:54:27 +00:00
Murai Takashi
f8278c1398 codycam: Fix PVS 1321
Fix local variable 'fSettingsDir' is same name as Settings class member
'fSettingsDir'.
https://git.haiku-os.org/haiku/tree/src/apps/codycam/SettingsHandler.h#n148

Change-Id: Ifa12b3239e88bf1f7f29c77704ea1f9f161384f7
Reviewed-on: https://review.haiku-os.org/752
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2018-12-04 12:30:53 +00:00
Augustin Cavalier
652a4674d4 emulex_oce: Add firmware macros to glue code.
The driver optionally can load new firmware onto the device, but
we don't currently ship it. But because it tries to use it means
the symbols get linked in, and so on debug builds it failed to link
since these macros weren't there.
2018-12-02 17:19:32 -05:00
Augustin Cavalier
e24ef16936 EFI: Architecture-specific code depends on GNUEFI headers.
Hopefully fixes the buildbot's recent breakage.
2018-12-02 17:06:54 -05:00
Adrien Destugues
151343ebc8 BLooper: API to hijack existing thread.
I need this to use loopers in WebKit, which spawns threads and expects
to be able to turn them into event loops later on.

This is the pattern already used in BApplication, we may as well make it
available elsewhere.

Change-Id: I5939ca89d33cb3bcc92567b302c2038d976af598
Reviewed-on: https://review.haiku-os.org/735
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-02 21:36:31 +00:00
Jérôme Duval
4bba0571c6 demangler/gcc3+: when the parameter isn't found, return a useful error.
after the last argument, get_next_argument() would call get_next_argument_gcc3(),
see a failure, then call get_next_argument_gcc2(). Ideally we could make
different cookies for gcc2 and gcc3+ demanglers, thus avoiding this issue.

Change-Id: I3904e008a0b6ba627940fb9bca1d44ddbafbcbd0
Reviewed-on: https://review.haiku-os.org/742
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-12-02 21:35:09 +00:00
Murai Takashi
c9e6afb2af accelerants/radeon: Fix PVS 2007
Fix the '?:' operator returns same value.

Change-Id: I439d30f78213e0dc80c6fed90e5068618faea1fa
Reviewed-on: https://review.haiku-os.org/738
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-02 21:32:09 +00:00
Murai Takashi
b63646d69c bin/trash: Fix PVS 787
Fix 'err' is assigned values twice successively.

Change-Id: I783094dacbd99880381d0359c66359177611506e
Reviewed-on: https://review.haiku-os.org/746
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-02 21:31:26 +00:00
Murai Takashi
4c5e5d8b04 tools/locale: Fix using auto_ptr to array.
Use BStackOrHeapArray instead of using auto_ptr to array.

Change-Id: I171cb002829c36ec51ba7d1e387869263e2a40f2
Reviewed-on: https://review.haiku-os.org/745
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-02 21:31:26 +00:00
Murai Takashi
6439130107 add-ons/locale: Remove unused auto_ptr
Change-Id: Ibe10945ce38dec3f4be229450ba32125539dfdd1
Reviewed-on: https://review.haiku-os.org/744
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-02 21:31:26 +00:00
Jérôme Duval
9f4b382338 wctype: have towlower and towupper check char ranges with no locale backend.
Change-Id: Ie63977bcf54ce9b0a2fa542ba5327c8e8b050e2e
Reviewed-on: https://review.haiku-os.org/740
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2018-12-02 21:28:43 +00:00
Barrett17
bc6fcc8aae ape_reader: Remove pedantic instantiate_plugin declaration 2018-12-01 12:43:30 +01:00