I find null pointer bug when I debug the kernel of loongson in mips,I think the function fb_set_suspend() adding pointer judgment will more friendly.
[ 101.409101] PM: hibernation entry
[ 101.526365] PM: Syncing filesystems ...
[ 101.543008] PM: done.
[ 101.545287] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 101.553722] OOM killer disabled.
[ 101.556988] PM: Preallocating image memory... done (allocated 79819 pages)
[ 101.709595] PM: Allocated 1277104 kbytes in 0.14 seconds (9122.17 MB/s)
[ 101.716179] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 101.761338] CPU 1 Unable to handle kernel paging request at virtual address 00000000000003e0, epc == ffffffff81068e10, ra == ffffffff81068e0c
[ 101.777602] Oops[#1]:
[ 101.779858] CPU: 1 PID: 1099 Comm: kworker/u8:6 Tainted: G W 4.19.0-loongson-3-desktop #43
[ 101.789368] Hardware name: Dahua DH-HDC5000L/M2001, BIOS L4J74B006DHT0318 V4.0 03/18/2021 16:44:33
[ 101.798282] Workqueue: events_unbound async_run_entry_fn
[ 101.803557] \$ 0 : 0000000000000000 0000000000000001 0000000000000001 0000000000000000
[ 101.811513] \$ 4 : ffffffff822426f0 0000000000000001 980000000754b510 0000000000000000
[ 101.819468] \$ 8 : 000000000000031d 202c796669746f6e 31202c796669746f ffffffff82220000
[ 101.827423] \$12 : 0000000000000001 ffffffff8244ba15 ffffffffffffffff 0000000000000030
[ 101.835378] \$16 : 0000000000000000 ffffffff8038bd40 ffffffffc0070000 0000000000000001
[ 101.843333] \$20 : ffffffffc006cbc0 980000025d84b040 980000025516f2e0 980000025516f300
[ 101.851288] \$24 : 0000000000000000 ffffffff811fd880
[ 101.859244] \$28 : 980000025d07c000 980000025d07fc40 ffffffffc0070000 ffffffff81068e0c
[ 101.867199] Hi : 0000000000b807f2
[ 101.870746] Lo : f1a9fbe76d65cd06
[ 101.874298] epc : ffffffff81068e10 fb_set_suspend+0x50/0x80
[ 101.880006] ra : ffffffff81068e0c fb_set_suspend+0x4c/0x80
[ 101.885712] Status: 5400cce3 KX SX UX KERNEL EXL IE
[ 101.890645] Cause : 1080000c (ExcCode 03)
[ 101.894623] BadVA : 00000000000003e0
[ 101.898170] PrId : 0014c004 (ICT Loongson-3)
[ 101.902494] Modules linked in: fuse bluetooth ecdh_generic sha256_generic cfg80211 rfkill vfat fat serio_raw uio_pdrv_genirq binfmt_misc ip_td
[ 101.918414] Process kworker/u8:6 (pid: 1099, threadinfo=00000000b0273bba, task=00000000b7551ec1, tls=0000000000000000)
[ 101.929045] Stack : 0000000000000000 6c635f7473696c5f 980000025516f308 ffffffffc0061aa0
[ 101.937001] ffffffffc0070000 ffffffffc006d7c0 ffffffffc006ce00 0000000000000000
[ 101.944955] 980000025c056098 ffffffffc0070238 ffffffff83490000 0000000000000001
[ 101.952910] 980000025c0560f8 0000000000000000 ffffffff82218830 ffffffff82290000
[ 101.960865] 980000025cfb8480 ffffffffc0061c58 0000000000000001 ffffffff81008fd4
[ 101.968819] 980000025c056098 980000025c056220 0000000000000000 ffffffff81008f40
[ 101.976774] 0000000000000000 ffffffff815377e0 980000025c0560f8 980000025c056098
[ 101.984729] 0000000000000000 ffffffff81539608 ffffffff82218830 980000025c056098
[ 101.992684] ffffffff83490000 ffffffff82370000 980000025c018000 980000025c01c000
[ 102.000638] 0000000000000000 ffffffff81539aac 980000025d07fd68 98000001cacd0fa0
[ 102.008593] ...
[ 102.011018] Call Trace:
[ 102.013443] [<ffffffff81068e10>] fb_set_suspend+0x50/0x80
[ 102.018819] [<ffffffffc0061aa0>] loongson_drm_suspend+0x1a0/0x340 [loongson]
[ 102.025827] [<ffffffffc0061c58>] loongson_pmops_freeze+0x18/0x40 [loongson]
[ 102.032748] [<ffffffff81008fd4>] pci_pm_freeze+0x94/0x240
[ 102.038114] [<ffffffff815377e0>] dpm_run_callback.isra.5+0x20/0x140
[ 102.044341] [<ffffffff81539608>] __device_suspend+0x2c8/0x740
[ 102.050049] [<ffffffff81539aac>] async_suspend+0x2c/0x1c0
[ 102.055411] [<ffffffff803157cc>] async_run_entry_fn+0x8c/0x280
[ 102.061207] [<ffffffff802fea3c>] process_one_work+0x43c/0x980
[ 102.066915] [<ffffffff802ff2a4>] worker_thread+0x324/0xc00
[ 102.072364] [<ffffffff8030cde0>] kthread+0x1e0/0x200
[ 102.077296] [<ffffffff80220688>] ret_from_kernel_thread+0x14/0x1c
[ 102.083350] Code: 0c41a0a0 24040002 24020001 <ae0203e0> dfbf0018 dfb00010 03e00008 67bd0020 00000000
[ 102.093038]
[ 102.094531] ---[ end trace 3ed8a43fa8cf3077 ]---
From: "Matthew Wilcox <willy@xxxxxxxxxxxxx>"
To: "songqiang <songqiang@xxxxxxxxxxxxx>"
CC: "sam <sam@xxxxxxxxxxxx>","b.zolnierkie <b.zolnierkie@xxxxxxxxxxx>","penguin-kernel <penguin-kernel@xxxxxxxxxxxxxxxxxxx>","george.kennedy <george.kennedy@xxxxxxxxxx>","arnd <arnd@xxxxxxxx>","tzimmermann <tzimmermann@xxxxxxx>","jgg <jgg@xxxxxxxx>","dri-devel <dri-devel@xxxxxxxxxxxxxxxxxxxxx>","linux-fbdev <linux-fbdev@xxxxxxxxxxxxxxx>","linux-kernel <linux-kernel@xxxxxxxxxxxxxxx>"
Sent: 2021-05-19 20:16
Subject: Re: [PATCH] drivers/video/fbdev/core/fbmem.c: add pointer judgment
On Wed, May 19, 2021 at 08:00:28PM +0800, songqiang wrote:
> Signed-off-by: songqiang <songqiang@xxxxxxxxxxxxx>
> ---
You need to explain:
- Why you think this patch is needed
- Did you observe a problem at runtime?
- Is this the output from some checking tool?
- Why this is the right way to address the problem