Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL usesConversion performed via this Coccinelle script: // SPDX-License-Identifier: GPL-2.0-only // Options: --include-headers-for-types -
Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL usesConversion performed via this Coccinelle script: // SPDX-License-Identifier: GPL-2.0-only // Options: --include-headers-for-types --all-includes --include-headers --keep-comments virtual patch @gfp depends on patch && !(file in "tools") && !(file in "samples")@ identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex, kzalloc_obj,kzalloc_objs,kzalloc_flex, kvmalloc_obj,kvmalloc_objs,kvmalloc_flex, kvzalloc_obj,kvzalloc_objs,kvzalloc_flex}; @@ ALLOC(... - , GFP_KERNEL ) $ make coccicheck MODE=patch COCCI=gfp.cocciBuild and boot tested x86_64 with Fedora 42's GCC and Clang:Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01Signed-off-by: Kees Cook <kees@kernel.org>Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
show more ...
Convert 'alloc_obj' family to use the new default GFP_KERNEL argumentThis was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs
Convert 'alloc_obj' family to use the new default GFP_KERNEL argumentThis was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'to convert the new alloc_obj() users that had a simple GFP_KERNELargument to just drop that argument.Note that due to the extreme simplicity of the scripting, any slightlymore complex cases spread over multiple lines would not be triggered:they definitely exist, but this covers the vast bulk of the cases, andthe resulting diff is also then easier to check automatically.For the same reason the 'flex' versions will be done as a separateconversion.Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
treewide: Replace kmalloc with kmalloc_obj for non-scalar typesThis is the result of running the Coccinelle script fromscripts/coccinelle/api/kmalloc_objs.cocci. The script is designed toavoid sc
treewide: Replace kmalloc with kmalloc_obj for non-scalar typesThis is the result of running the Coccinelle script fromscripts/coccinelle/api/kmalloc_objs.cocci. The script is designed toavoid scalar types (which need careful case-by-case checking), andinstead replace kmalloc-family calls that allocate struct or unionobject instances:Single allocations: kmalloc(sizeof(TYPE), ...)are replaced with: kmalloc_obj(TYPE, ...)Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)are replaced with: kmalloc_objs(TYPE, COUNT, ...)Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)(where TYPE may also be *VAR)The resulting allocations no longer return "void *", instead returning"TYPE *".Signed-off-by: Kees Cook <kees@kernel.org>
platform/x86: Switch back to struct platform_driver::remove()After commit 0edb555a65d1 ("platform: Make platform_driver::remove()return void") .remove() is (again) the right callback to implement
platform/x86: Switch back to struct platform_driver::remove()After commit 0edb555a65d1 ("platform: Make platform_driver::remove()return void") .remove() is (again) the right callback to implement forplatform drivers.Convert all platform drivers below drivers/platform/x86/ to use.remove(), with the eventual goal to drop structplatform_driver::remove_new(). As .remove() and .remove_new() have thesame prototypes, conversion is done by just changing the structuremember name in the driver initializer.While touching these files, make indention of the struct initializerconsistent in several files.Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>Link: https://lore.kernel.org/r/20241017073802.53235-2-u.kleine-koenig@baylibre.comReviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
platform/x86: intel: int1092: intel_sar: Convert to platform remove callback returning voidThe .remove() callback for a platform driver returns an int which makesmany driver authors wrongly assume
platform/x86: intel: int1092: intel_sar: Convert to platform remove callback returning voidThe .remove() callback for a platform driver returns an int which makesmany driver authors wrongly assume it's possible to do error handling byreturning an error code. However the value returned is (mostly) ignoredand this typically results in resource leaks. To improve here there is aquest to make the remove callback return void. In the first step of thisquest all drivers are converted to .remove_new() which already returnsvoid.Trivially convert this driver from always returning zero in the removecallback to the void returning variant.Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>Link: https://lore.kernel.org/r/20230302144732.1903781-21-u.kleine-koenig@pengutronix.deReviewed-by: Hans de Goede <hdegoede@redhat.com>Signed-off-by: Hans de Goede <hdegoede@redhat.com>
platform/x86: int1092: Switch to use acpi_evaluate_dsm_typed()The acpi_evaluate_dsm_typed() provides a way to check the type of theobject evaluated by _DSM call. Use it instead of open coded varia
platform/x86: int1092: Switch to use acpi_evaluate_dsm_typed()The acpi_evaluate_dsm_typed() provides a way to check the type of theobject evaluated by _DSM call. Use it instead of open coded variant.Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>Link: https://lore.kernel.org/r/20230119180904.78446-1-andriy.shevchenko@linux.intel.comReviewed-by: Hans de Goede <hdegoede@redhat.com>Signed-off-by: Hans de Goede <hdegoede@redhat.com>
platform/x86: int1092: Fix non sequential device mode handlingSAR information from BIOS may come in non sequential pattern.To overcome the issue, a check is made to extract the right SARinformat
platform/x86: int1092: Fix non sequential device mode handlingSAR information from BIOS may come in non sequential pattern.To overcome the issue, a check is made to extract the right SARinformation using the device mode which is currently being used.Remove .owner field if calls are used which set it automatically.Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocciSigned-off-by: Shravan S <s.shravan@intel.com>Link: https://lore.kernel.org/r/20211006073525.1332925-1-s.shravan@intel.comSigned-off-by: Hans de Goede <hdegoede@redhat.com>Reviewed-by: Hans de Goede <hdegoede@redhat.com>
platform/x86: BIOS SAR driver for Intel M.2 ModemDynamic BIOS SAR driver exposing dynamic SAR information from BIOSThe Dynamic SAR (Specific Absorption Rate) driver uses ACPI DSM(Device Specific
platform/x86: BIOS SAR driver for Intel M.2 ModemDynamic BIOS SAR driver exposing dynamic SAR information from BIOSThe Dynamic SAR (Specific Absorption Rate) driver uses ACPI DSM(Device Specific Method) to communicate with BIOS and retrievedynamic SAR information and change notifications. The driver usessysfs to expose this data to userspace via read and notify.Sysfs interface is documented in detail under:Documentation/ABI/testing/sysfs-driver-intc_sarSigned-off-by: Shravan S <s.shravan@intel.com>Link: https://lore.kernel.org/r/20210723211452.27995-2-s.shravan@intel.comReviewed-by: Hans de Goede <hdegoede@redhat.com>Signed-off-by: Hans de Goede <hdegoede@redhat.com>