From 9ee5ae1fae1d7e19f76d4758d9658af90018b0f9 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 27 Jan 2015 17:17:58 +0100
Subject: [PATCH] Document intentional fallthroughs.

Found by: Coverity scan.
---
 grub-core/disk/diskfilter.c      | 3 +++
 grub-core/font/font.c            | 3 ++-
 grub-core/fs/udf.c               | 1 +
 grub-core/lib/legacy_parse.c     | 1 +
 grub-core/loader/i386/pc/linux.c | 3 +++
 grub-core/normal/charset.c       | 1 +
 grub-core/video/bochs.c          | 1 +
 grub-core/video/cirrus.c         | 1 +
 grub-core/video/i386/pc/vbe.c    | 2 ++
 util/getroot.c                   | 1 +
 util/grub-install.c              | 2 +-
 11 files changed, 17 insertions(+), 2 deletions(-)

Index: grub-2.00/grub-core/disk/diskfilter.c
===================================================================
--- grub-2.00.orig/grub-core/disk/diskfilter.c
+++ grub-2.00/grub-core/disk/diskfilter.c
@@ -71,10 +71,12 @@ is_lv_readable (struct grub_diskfilter_l
 	case GRUB_DISKFILTER_RAID6:
 	  if (!easily)
 	    need--;
+	  /* Fallthrough.  */
 	case GRUB_DISKFILTER_RAID4:
 	case GRUB_DISKFILTER_RAID5:
 	  if (!easily)
 	    need--;
+	  /* Fallthrough.  */
 	case GRUB_DISKFILTER_STRIPED:
 	  break;
 
@@ -507,6 +509,7 @@ read_segment (struct grub_diskfilter_seg
       if (seg->node_count == 1)
 	return grub_diskfilter_read_node (&seg->nodes[0],
 					  sector, size, buf);
+      /* Fallthrough.  */
     case GRUB_DISKFILTER_MIRROR:
     case GRUB_DISKFILTER_RAID10:
       {
Index: grub-2.00/grub-core/font/font.c
===================================================================
--- grub-2.00.orig/grub-core/font/font.c
+++ grub-2.00/grub-core/font/font.c
@@ -1297,7 +1297,7 @@ blit_comb (const struct grub_unicode_gly
 	    - grub_font_get_xheight (combining_glyphs[i]->font) - 1;
 	  if (space <= 0)
 	    space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8;
-
+	  /* Fallthrough.  */
 	case GRUB_UNICODE_STACK_ATTACHED_ABOVE:
 	  do_blit (combining_glyphs[i], targetx,
 		   -(bounds.height + bounds.y + space
@@ -1338,6 +1338,7 @@ blit_comb (const struct grub_unicode_gly
 		    + combining_glyphs[i]->height);
 	  if (space <= 0)
 	    space = 1 + (grub_font_get_xheight (main_glyph->font)) / 8;
+	  /* Fallthrough.  */
 
 	case GRUB_UNICODE_STACK_ATTACHED_BELOW:
 	  do_blit (combining_glyphs[i], targetx, -(bounds.y - space));
Index: grub-2.00/grub-core/fs/udf.c
===================================================================
--- grub-2.00.orig/grub-core/fs/udf.c
+++ grub-2.00/grub-core/fs/udf.c
@@ -970,6 +970,7 @@ grub_udf_read_symlink (grub_fshelp_node_
 	case 1:
 	  if (ptr[1])
 	    goto fail;
+	  /* Fallthrough.  */
 	case 2:
 	  /* in 4 bytes. out: 1 byte.  */
 	  optr = out;
Index: grub-2.00/grub-core/lib/legacy_parse.c
===================================================================
--- grub-2.00.orig/grub-core/lib/legacy_parse.c
+++ grub-2.00/grub-core/lib/legacy_parse.c
@@ -629,6 +629,7 @@ grub_legacy_parse (const char *buf, char
 	  {
 	  case TYPE_FILE_NO_CONSUME:
 	    hold_arg = 1;
+	    /* Fallthrough.  */
 	  case TYPE_PARTITION:
 	  case TYPE_FILE:
 	    args[i] = adjust_file (curarg, curarglen);
Index: grub-2.00/grub-core/loader/i386/pc/linux.c
===================================================================
--- grub-2.00.orig/grub-core/loader/i386/pc/linux.c
+++ grub-2.00/grub-core/loader/i386/pc/linux.c
@@ -253,10 +253,13 @@ grub_cmd_linux (grub_command_t cmd __att
 	      {
 	      case 'g':
 		shift += 10;
+		/* Fallthrough.  */
 	      case 'm':
 		shift += 10;
+		/* Fallthrough.  */
 	      case 'k':
 		shift += 10;
+		/* Fallthrough.  */
 	      default:
 		break;
 	      }
Index: grub-2.00/grub-core/normal/charset.c
===================================================================
--- grub-2.00.orig/grub-core/normal/charset.c
+++ grub-2.00/grub-core/normal/charset.c
@@ -858,6 +858,7 @@ grub_bidi_line_logical_to_visual (const
 	  case GRUB_BIDI_TYPE_R:
 	  case GRUB_BIDI_TYPE_AL:
 	    bidi_needed = 1;
+	    /* Fallthrough.  */
 	  default:
 	    {
 	      if (join_state == JOIN_FORCE)
Index: grub-2.00/grub-core/video/bochs.c
===================================================================
--- grub-2.00.orig/grub-core/video/bochs.c
+++ grub-2.00/grub-core/video/bochs.c
@@ -351,6 +351,7 @@ grub_video_bochs_setup (unsigned int wid
     case 32:
       framebuffer.mode_info.reserved_mask_size = 8;
       framebuffer.mode_info.reserved_field_pos = 24;
+      /* Fallthrough.  */
 
     case 24:
       framebuffer.mode_info.red_mask_size = 8;
Index: grub-2.00/grub-core/video/cirrus.c
===================================================================
--- grub-2.00.orig/grub-core/video/cirrus.c
+++ grub-2.00/grub-core/video/cirrus.c
@@ -431,6 +431,7 @@ grub_video_cirrus_setup (unsigned int wi
     case 32:
       framebuffer.mode_info.reserved_mask_size = 8;
       framebuffer.mode_info.reserved_field_pos = 24;
+      /* Fallthrough.  */
 
     case 24:
       framebuffer.mode_info.red_mask_size = 8;
Index: grub-2.00/grub-core/video/i386/pc/vbe.c
===================================================================
--- grub-2.00.orig/grub-core/video/i386/pc/vbe.c
+++ grub-2.00/grub-core/video/i386/pc/vbe.c
@@ -875,6 +875,7 @@ vbe2videoinfo (grub_uint32_t mode,
       /* CGA is basically 4-bit packed pixel.  */
     case GRUB_VBE_MEMORY_MODEL_CGA:
       mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_CGA;
+      /* Fallthrough.  */
     case GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL:
       mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
       break;
@@ -887,6 +888,7 @@ vbe2videoinfo (grub_uint32_t mode,
       /* Non chain 4 is a special case of planar.  */
     case GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256:
       mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_NONCHAIN4;
+      /* Fallthrough.  */
     case GRUB_VBE_MEMORY_MODEL_PLANAR:
       mode_info->mode_type |= GRUB_VIDEO_MODE_TYPE_PLANAR
 	| GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
