Tue Aug 19 13:44:31 2014 UTC ()
Make sure to not dereference a NULL pointer.


(martin)
diff -r1.5 -r1.6 src/usr.sbin/sysinst/partman.c

cvs diff -r1.5 -r1.6 src/usr.sbin/sysinst/partman.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/partman.c 2014/08/19 13:41:08 1.5
+++ src/usr.sbin/sysinst/partman.c 2014/08/19 13:44:31 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: partman.c,v 1.5 2014/08/19 13:41:08 martin Exp $ */ 1/* $NetBSD: partman.c,v 1.6 2014/08/19 13:44:31 martin Exp $ */
2 2
3/* 3/*
4 * Copyright 2012 Eugene Lozovoy 4 * Copyright 2012 Eugene Lozovoy
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -2404,37 +2404,38 @@ pm_submenu(menudesc *m, void *arg) @@ -2404,37 +2404,38 @@ pm_submenu(menudesc *m, void *arg)
2404 process_menu(MENU_noyes, NULL); 2404 process_menu(MENU_noyes, NULL);
2405 if (!yesno) 2405 if (!yesno)
2406 return -2; 2406 return -2;
2407 pm_cur->blocked = 0; 2407 pm_cur->blocked = 0;
2408 } 2408 }
2409 pm_select(pm_cur); 2409 pm_select(pm_cur);
2410 } 2410 }
2411 default: 2411 default:
2412 break; 2412 break;
2413 } 2413 }
2414 2414
2415 switch (((part_entry_t *)arg)[m->cursel].type) { 2415 switch (((part_entry_t *)arg)[m->cursel].type) {
2416 case PM_DISK_T: 2416 case PM_DISK_T:
2417 if (pm_cur->gpt) { 2417 if (pm_cur != NULL && pm_cur->gpt) {
2418 process_menu(MENU_pmgptentry, &part_num); 2418 process_menu(MENU_pmgptentry, &part_num);
2419 pm_wedges_fill(pm_cur); 2419 pm_wedges_fill(pm_cur);
2420 } else 2420 } else {
2421 process_menu(MENU_pmdiskentry, &part_num); 2421 process_menu(MENU_pmdiskentry, &part_num);
 2422 }
2422 break; 2423 break;
2423 case PM_WEDGE_T: 2424 case PM_WEDGE_T:
2424 case PM_PART_T: 2425 case PM_PART_T:
2425 part_num = ((part_entry_t *)arg)[m->cursel].dev_num; 2426 part_num = ((part_entry_t *)arg)[m->cursel].dev_num;
2426 process_menu(MENU_pmpartentry, &part_num); 2427 process_menu(MENU_pmpartentry, &part_num);
2427 if (pm_cur->gpt) 2428 if (pm_cur != NULL && pm_cur->gpt)
2428 pm_wedges_fill(pm_cur); 2429 pm_wedges_fill(pm_cur);
2429 break; 2430 break;
2430 case PM_SPEC_T: 2431 case PM_SPEC_T:
2431 part_num = 0; 2432 part_num = 0;
2432 process_menu(MENU_pmpartentry, &part_num); 2433 process_menu(MENU_pmpartentry, &part_num);
2433 break; 2434 break;
2434 case PM_RAID_T: 2435 case PM_RAID_T:
2435 return pm_edit(PMR_MENU_END, pm_raid_edit_menufmt, 2436 return pm_edit(PMR_MENU_END, pm_raid_edit_menufmt,
2436 pm_raid_set_value, pm_raid_check, pm_raid_init, 2437 pm_raid_set_value, pm_raid_check, pm_raid_init,
2437 NULL, ((part_entry_t *)arg)[m->cursel].dev_ptr, 0, &raids_t_info); 2438 NULL, ((part_entry_t *)arg)[m->cursel].dev_ptr, 0, &raids_t_info);
2438 case PM_VND_T: 2439 case PM_VND_T:
2439 return pm_edit(PMV_MENU_END, pm_vnd_edit_menufmt, 2440 return pm_edit(PMV_MENU_END, pm_vnd_edit_menufmt,
2440 pm_vnd_set_value, pm_vnd_check, pm_vnd_init, 2441 pm_vnd_set_value, pm_vnd_check, pm_vnd_init,