@@ -221,7 +221,10 @@ __verify_patch_size(u8 family, u32 sh_psize, unsigned int buf_size)
221221static unsigned int
222222verify_patch (u8 family , const u8 * buf , unsigned int buf_size , bool early )
223223{
224+ struct microcode_header_amd * mc_hdr ;
224225 u32 sh_psize ;
226+ u16 proc_id ;
227+ u8 patch_fam ;
225228
226229 if (!__verify_patch_section (buf , buf_size , & sh_psize , early ))
227230 return 0 ;
@@ -243,6 +246,13 @@ verify_patch(u8 family, const u8 *buf, unsigned int buf_size, bool early)
243246 return 0 ;
244247 }
245248
249+ mc_hdr = (struct microcode_header_amd * )(buf + SECTION_HDR_SIZE );
250+ proc_id = mc_hdr -> processor_rev_id ;
251+
252+ patch_fam = 0xf + (proc_id >> 12 );
253+ if (patch_fam != family )
254+ return 0 ;
255+
246256 return __verify_patch_size (family , sh_psize , buf_size );
247257}
248258
@@ -718,7 +728,6 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover)
718728 struct microcode_header_amd * mc_hdr ;
719729 unsigned int patch_size , crnt_size ;
720730 struct ucode_patch * patch ;
721- u8 patch_fam ;
722731 u16 proc_id ;
723732
724733 patch_size = verify_patch (family , fw , leftover , false);
@@ -732,10 +741,6 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover)
732741 mc_hdr = (struct microcode_header_amd * )(fw + SECTION_HDR_SIZE );
733742 proc_id = mc_hdr -> processor_rev_id ;
734743
735- patch_fam = 0xf + (proc_id >> 12 );
736- if (patch_fam != family )
737- return crnt_size ;
738-
739744 if (mc_hdr -> nb_dev_id || mc_hdr -> sb_dev_id ) {
740745 pr_err ("Patch-ID 0x%08x: chipset-specific code unsupported.\n" ,
741746 mc_hdr -> patch_id );
0 commit comments